def format_datatypes(datatypes, whitelist=None):
    """Interprets and formats numpy/python datatypes as either 'numeric' or 'text'"""
    def format_one(type_obj):
        """Formats a single datatype"""
        type_obj = str(type_obj)
        if 'float' in type_obj or 'int' in type_obj:
            return 'numeric'
        elif 'object' in type_obj or 'unicode' in type_obj or 'str' in type_obj:
            return 'text'
        elif 'bytes' in type_obj:
            return 'binary'
        else:
            raise ValueError("Unknown data type: {}".format(str(type_obj)))

    if whitelist is None:
        whitelist = list(datatypes.keys())
    return {feat: format_one(dt) for feat, dt in datatypes.items() if feat in whitelist}