"""General logic.""" from ows_accounting.constants import header def get_user_type_from_accounting_type(account_type): """Get user type from account type, picked up from GRASS. Args: account_type (str): vendor or subaccount. Returns: Response: response object with a list of integer values of accounting period ids. Raises: ValueError: if not proper account type. """ try: return header.USER_TYPES[account_type] except KeyError: raise ValueError( "The '{account_type}' account_type is not valid.".format( account_type=account_type))