original_docstring:  Update a property of an account.
  
      :param account: Name of the account.
      :param key: Account property like status.
      :param value: Property value.
      :param session: the database session in use.
      
docstring: Update a property of an account.
docstring_tokens: Update a property of an account .
code: def update_account(account, key, value, session=None):
      """ Update a property of an account.
  
      :param account: Name of the account.
      :param key: Account property like status.
      :param value: Property value.
      :param session: the database session in use.
      """
      query = session.query(models.Account).filter_by(account=account)
      try:
          account = query.one()
      except exc.NoResultFound:
          raise exception.AccountNotFound('Account with ID \'%s\' cannot be found' % account)
      if key == 'status':
          if isinstance(value, string_types):
              value = AccountStatus.from_sym(value)
          if value == AccountStatus.SUSPENDED:
              query.update({'status': value, 'suspended_at': datetime.utcnow()})
          elif value == AccountStatus.ACTIVE:
              query.update({'status': value, 'suspended_at': None})
      else:
          query.update({key: value})
code_tokens: def update_account ( account , key , value , session = None ) : query = session . query ( models . Account ) . filter_by ( account = account ) try : account = query . one ( ) except exc . NoResultFound : raise exception . AccountNotFound ( 'Account with ID \'%s\' cannot be found' % account ) if key == 'status' : if isinstance ( value , string_types ) : value = AccountStatus . from_sym ( value ) if value == AccountStatus . SUSPENDED : query . update ( { 'status' : value , 'suspended_at' : datetime . utcnow ( ) } ) elif value == AccountStatus . ACTIVE : query . update ( { 'status' : value , 'suspended_at' : None } ) else : query . update ( { key : value } )
short_docstring: Update a property of an account.
short_docstring_tokens: Update a property of an account .
comment: """ Update a property of an account.
  
      :param account: Name of the account.
      :param key: Account property like status.
      :param value: Property value.
      :param session: the database session in use.
      """