"""User-related utility functions.""" from analytics.consts.user import AccountTypes from analytics.models import user def create(id, type): """Create user based on a set of data. Args: id (int): the user id. type (str): the user type. Returns: User, status: the user information and the status of the request. If an error has happened when commiting the information, a 500 is returned. """ return user.create_user(id=id, type=type) def is_user_vendor(user): """Check if a user is a vendor. Args: user (User): the user object. Returns: bool: if the user is a label. """ return user.type == AccountTypes.VENDOR def is_user_subaccount(user): """Check if a user is a subaccount. Args: user (User): the user object. Returns: bool: if the user is a subaccount. """ return user.type == AccountTypes.SUBACCOUNT