def does_type_match(main_type, sub_type, main_item, sub_item):
    # type: (str, str, str, str) -> bool
    """Return True iff mime type matches item type.

    For example:

    >>> does_type_match("*", "any", "any", "any")
    True
    >>> does_type_match("main", "*", "main", "any")
    True
    >>> does_type_match("main", "*", "item", "any")
    False
    >>> does_type_match("main", "sub", "main", "sub")
    True
    >>> does_type_match("main", "sub", "main", "item")
    False

    """
    if main_type == "*":
        return True
    if main_type == main_item:
        if sub_type == "*":
            return True
        return sub_type == sub_item
    return False