'Return an instance based on the given primary key identifier,
or ``None`` if not found.
E.g.::
my_user = session.query(User).get(5)
some_object = session.query(VersionedFoo).get((5, 10))
:meth:`~.Query.get` is special in that it provides direct
access to the identity map of the owning :class:`.Session`.
If the given primary key identifier is present
in the local identity map, the object is returned
directly from this collection and no SQL is emitted,
unless the object has been marked fully expired.
If not present,
a SELECT is performed in order to locate the object.
:meth:`~.Query.get` also will perform a check if
the object is present in the identity map and
marked as expired - a SELECT
is emitted to refresh the object as well as to
ensure that the row is still present.
If not, :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised.
:meth:`~.Query.get` is only used to return a single
mapped instance, not multiple instances or
individual column constructs, and strictly
on a single primary key value.  The originating
:class:`.Query` must be constructed in this way,
i.e. against a single mapped entity,
with no additional filtering criterion.  Loading
options via :meth:`~.Query.options` may be applied
however, and will be used if the object is not
yet locally present.
A lazy-loading, many-to-one attribute configured
by :func:`.relationship`, using a simple
foreign-key-to-primary-key criterion, will also use an
operation equivalent to :meth:`~.Query.get` in order to retrieve
the target value from the local identity map
before querying the database.  See :doc:`/orm/loading`
for further details on relationship loading.
:param ident: A scalar or tuple value representing
the primary key.   For a composite primary key,
the order of identifiers corresponds in most cases
to that of the mapped :class:`.Table` object\'s
primary key columns.  For a :func:`.mapper` that
was given the ``primary key`` argument during
construction, the order of identifiers corresponds
to the elements present in this collection.
:return: The object instance, or ``None``.'

def get(self, ident):

    if hasattr(ident, '__composite_values__'):
        ident = ident.__composite_values__()
    ident = util.to_list(ident)
    mapper = self._only_full_mapper_zero('get')
    if (len(ident) != len(mapper.primary_key)):
        raise sa_exc.InvalidRequestError(('Incorrect    number    of    values    in    identifier    to    formulate    primary    key    for    query.get();    primary    key    columns    are    %s' % ','.join((("'%s'" % c) for c in mapper.primary_key))))
    key = mapper.identity_key_from_primary_key(ident)
    if ((not self._populate_existing) and (not mapper.always_refresh) and (self._for_update_arg is None)):
        instance = loading.get_from_identity(self.session, key, attributes.PASSIVE_OFF)
        if (instance is not None):
            self._get_existing_condition()
            if (not issubclass(instance.__class__, mapper.class_)):
                return None
            return instance
    return loading.load_on_ident(self, key)
