<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def by_version(cls, session, package_name, version):
 """ Get release for a given version. :param session: SQLAlchemy session :type session: :class:`sqlalchemy.Session` :param package_name: package name :type package_name: unicode :param version: version :type version: unicode :return: release instance :rtype: :class:`pyshop.models.Release` """

        return cls.first(session,
                         join=(Package,),
                         where=((Package.name == package_name),
                                (cls.version == version)))