def unwrap(value):
    """
    Unwraps the given Document or DocumentList as applicable.
    """
    if isinstance(value, Document):
        return value.to_dict()
    elif isinstance(value, DocumentList):
        return value.to_list()
    else:
        return value
def unwrap ( value ) : if isinstance ( value , Document ) : return value . to_dict ( ) elif isinstance ( value , DocumentList ) : return value . to_list ( ) else : return value
Unwraps the given Document or DocumentList as applicable.