"""Module that checks product ownership.""" from assets.models import ows_product from assets.models import ows_track def check_ownership(product_id, account_type=None, account_id=None): """Method to check grass user product ownership. Args: product_id (int): Product id. account_type (str): Grass account type. account_id (int): Grass account id. Returns: response.Response: Response object with success or failure message. """ return ows_product.check_ownership( account_type, account_id, product_id) def check_track_ownership(track_id, account_type=None, account_id=None): """Check grass user track ownership. Args: track_id (int): Unique track id. account_type (str): Grass account type. account_id (int): Grass account id. Returns: response.Response: Response object with success or failure message. """ track_response = ows_track.get_track_by_id(track_id) if not track_response: return track_response track = track_response.message return ows_product.check_ownership( account_type, account_id, track['product_id'])