def METHOD_NAME(self, key):
    """Returns True if all key:value pairs in `key` match 
    `appliance.metadata` or
    `Appliance.appliance_types[appliance.metadata['type']]`.
    Returns True if key is empty dict.
    By default, matches synonyms.  Set `Appliance.allow_synonyms = False`
    if you do not want to allow synonyms.
    Parameters
    ----------
    key : dict
    Returns
    -------
    Bool
    """
    if not key:
        return True
    if not isinstance(key, dict):
        raise TypeError()
    match = True
    for k, v in key.items():
        if hasattr(self.identifier, k):
            if Appliance.allow_synonyms and k == 'type':
                synonyms = self.type.get('synonyms', [])
                synonyms.append(self.identifier.type)
                if v not in synonyms:
                    match = False
            elif getattr(self.identifier, k) != v:
                match = False
        elif k in self.metadata:
            if self.metadata[k] != v:
                match = False
        elif k == 'category':
            if v not in self.categories():
                match = False
        elif k in self.type:
            metadata_value = self.type[k]
            if (isinstance(metadata_value, list) and
                    not isinstance(v, list)):
                # for example, 'control' is a list in metadata
                if v not in metadata_value:
                    match = False
            elif metadata_value != v:
                match = False
        else:
            raise KeyError("'{}' not a valid key.".format(k))
    return match