or `Appliance.appliance_types[appliance.metadata["type"]]`.
Returns True if key is empty dict.
if not key:
return True
if not isinstance(key, dict):
raise TypeError()
match = True
for k, v in key.iteritems():
if hasattr(self.identifier, k):
if getattr(self.identifier, k) != v:
match = False
elif self.metadata.has_key(k):
if self.metadata[k] != v:
match = False
if k == "category":
if v not in self.categories():
match = False
elif self.type.has_key(k):
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