code: def check_username_for_new_account(person, username):
      
  
      query = Account.objects.filter(
          username__exact=username,
          date_deleted__isnull=True)
  
      if query.count() > 0:
          raise UsernameTaken(
              six.u('Username already in use.')
          )
  
      if account_exists(username):
          raise UsernameTaken(
              six.u('Username is already in datastore.')
          )
  
      return username
docs: Check the new username for a new account. If the username  is
      in use, raises :py:exc:`UsernameTaken`.
  
      :param person: Owner of new account.
      :param username: Username to validate.