Returns true if datatype_instance is a valid datatype object and false otherwise.

def _is_valid_datatype(datatype_instance):
    """
    Returns true if datatype_instance is a valid datatype object and false otherwise.
    """

    # Remap so we can still use the python types for the simple cases
    global _simple_type_remap
    if datatype_instance in _simple_type_remap:
        return True

    # Now set the protobuf from this interface.
    if isinstance(datatype_instance, (Int64, Double, String, Array)):
        return True

    elif isinstance(datatype_instance, Dictionary):
        kt = datatype_instance.key_type

        if isinstance(kt, (Int64, String)):
            return True

    return False