@classmethod<EOL><INDENT>def fetch(cls, key, **context):<DEDENT>
<EOL>if isinstance(key, basestring) and not key.isdigit():<EOL><INDENT>keyable_columns = cls.schema().columns(flags=orb.Column.Flags.Keyable)<EOL>if keyable_columns:<EOL><INDENT>base_q = orb.Query()<EOL>for col in keyable_columns:<EOL><INDENT>base_q |= orb.Query(col) == key<EOL><DEDENT>context.setdefault('<STR_LIT>', base_q)<EOL><DEDENT>else:<EOL><INDENT>context.setdefault('<STR_LIT>', orb.Query(cls) == key)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>context.setdefault('<STR_LIT>', orb.Query(cls) == key)<EOL><DEDENT>context['<STR_LIT>'] = None<EOL>context['<STR_LIT>'] = None<EOL>context['<STR_LIT:start>'] = None<EOL>context['<STR_LIT>'] = None<EOL>return cls.select(**context).first()<EOL>
Looks up a record based on the given key.  This will use the
default id field, as well as any keyable properties if the
given key is a string.

:param key: <variant>
:param context: <orb.Context>
:return: <orb.Model> || None