@staticmethod
    def validate_dtype(termname, dtype, missing_value):
        """
        Validate a `dtype` and `missing_value` passed to Term.__new__.

        Ensures that we know how to represent ``dtype``, and that missing_value
        is specified for types without default missing values.

        Returns
        -------
        validated_dtype, validated_missing_value : np.dtype, any
            The dtype and missing_value to use for the new term.

        Raises
        ------
        DTypeNotSpecified
            When no dtype was passed to the instance, and the class doesn't
            provide a default.
        NotDType
            When either the class or the instance provides a value not
            coercible to a numpy dtype.
        NoDefaultMissingValue
            When dtype requires an explicit missing_value, but
            ``missing_value`` is NotSpecified.
        """
        if dtype is NotSpecified:
            raise DTypeNotSpecified(termname=termname)
        try:
            dtype = dtype_class(dtype)
        except __HOLE__:
            raise NotDType(dtype=dtype, termname=termname)

        if not can_represent_dtype(dtype):
            raise UnsupportedDType(dtype=dtype, termname=termname)

        if missing_value is NotSpecified:
            missing_value = default_missing_value_for_dtype(dtype)

        return dtype, missing_value
dataset/ETHPy150Open quantopian/zipline/zipline/pipeline/term.py/Term.validate_dtype