def __init__(self, key_type=None):
        """
        Constructs a Dictionary, given its key type

        Parameters
        ----------
        key_type: Int64 | String

        Examples
        --------
        >>> from coremltools.models.datatypes import Dictionary, Int64, String

        # Create a dictionary with string keys
        >>> str_key_dict = Dictionary(key_type=String)

        # Create a dictionary with int keys
        >>> int_key_dict = Dictionary(Int64)
        """
        # Resolve it to a class if it's
        global _simple_type_remap
        if key_type in _simple_type_remap:
            key_type = _simple_type_remap[key_type]

        if not isinstance(key_type, (Int64, String)):
            raise TypeError("Key type for dictionary must be either string or integer.")

        self.key_type = key_type

        _DatatypeBase.__init__(
            self, "Dictionary", "Dictionary(%s)" % repr(self.key_type), None
        )

        Constructs a Dictionary, given its key type

        Parameters
        ----------
        key_type: Int64 | String

        Examples
        --------
        >>> from coremltools.models.datatypes import Dictionary, Int64, String

        # Create a dictionary with string keys
        >>> str_key_dict = Dictionary(key_type=String)

        # Create a dictionary with int keys
        >>> int_key_dict = Dictionary(Int64)
        
coremltools/models/datatypes.py