code: def by_credentials(cls, session, login, password):
          
          user = cls.by_login(session, login, local=True)
          if not user:
              return None
          if crypt.check(user.password, password):
              return user
docs: Get a user from given credentials
  
          :param session: SQLAlchemy session
          :type session: :class:`sqlalchemy.Session`
  
          :param login: username
          :type login: unicode
  
          :param password: user password
          :type password: unicode
  
          :return: associated user
          :rtype: :class:`pyshop.models.User`