@check_type(JSONModelObject)
def closest_value(archival_object, key):
    'Finds the closest value matching a key.\n\n    Starts with an archival object, and iterates up through its ancestors\n    until it finds a match for a key that is not empty or null.\n\n    :param JSONModelObject archival_object: an ArchivesSpace archival_object.\n    :param str key: the key to match against.\n\n    :returns: The value of the key, which could be a str, list, or dict.\n    :rtype: str, list, or key\n    '
    if (getattr(archival_object, key) not in ['', [], {}, None]):
        return getattr(archival_object, key)
    else:
        for ancestor in archival_object.ancestors:
            return closest_value(ancestor, key)
Finds the closest value matching a key.

Starts with an archival object, and iterates up through its ancestors
until it finds a match for a key that is not empty or null.

:param JSONModelObject archival_object: an ArchivesSpace archival_object.
:param str key: the key to match against.

:returns: The value of the key, which could be a str, list, or dict.
:rtype: str, list, or key
@check_type(JSONModelObject)
def closest_value(archival_object, key):
    'Finds the closest value matching a key.\n\n    Starts with an archival object, and iterates up through its ancestors\n    until it finds a match for a key that is not empty or null.\n\n    :param JSONModelObject archival_object: an ArchivesSpace archival_object.\n    :param str key: the key to match against.\n\n    :returns: The value of the key, which could be a str, list, or dict.\n    :rtype: str, list, or key\n    '
    if (getattr(archival_object, key) not in [, [], {}, None]):
        return getattr(archival_object, key)
    else:
        for ancestor in archival_object.ancestors:
            return closest_value(ancestor, key)