def wrap(value):
if isinstance(value, Document) or isinstance(value, DocumentList):<EOL><INDENT>return value<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>return Document(value)<EOL><DEDENT>elif isinstance(value, list):<EOL><INDENT>return DocumentList(value)<EOL><DEDENT>else:<EOL><INDENT>return value<EOL><DEDENT>
Wraps the given value in a Document or DocumentList as applicable.