def _lookup(key, dictionary):
    """Lookup a key among either a dictionary's keys or values.
    """
    if key in dictionary.values():
        return key
    elif key in dictionary:
        return dictionary[key]
    else:
        return None