def widget_name(field, match_names=None):
    """
    Filter: Return the name of the widget class of the given field.

    The filter can be passed a space separated list of class name as an
    argument. In this case the filter will return True if any of the names
    match the widget class name and False if not.
    """
    name = type(field.field.widget).__name__
    if match_names:
        for a in match_names.split():
            if name == a:
                return True
        return False
    return name