code: def ensure_dtype(func, argname, arg):
      
      try:
          return dtype(arg)
      except TypeError:
          raise TypeError(
              "{func}() couldn't convert argument "
              "{argname}={arg!r} to a numpy dtype.".format(
                  func=_qualified_name(func),
                  argname=argname,
                  arg=arg,
              ),
          )
docs: Argument preprocessor that converts the input into a numpy dtype.
  
      Examples
      --------
      >>> import numpy as np
      >>> from zipline.utils.preprocess import preprocess
      >>> @preprocess(dtype=ensure_dtype)
      ... def foo(dtype):
      ...     return dtype
      ...
      >>> foo(float)
      dtype('float64')