code: def _convert(x: Any, dtype: type) -> Any:
      """Casts item `x` to `dtype` or None if not possible."""
  
      try:
          return dtype(x)
      except ValueError:
          return None
  
imports: from __future__ import annotations
  from typing import Any, Hashable
  import pandas
  import pandas_flavor
  from janitor.utils import deprecated_alias, refactored_function
label_desc: Use image node_id 2 for calling a global function with example usage: _convert(x, dtype) and returns: dtype, None