"""Regex utils.""" import re def is_recognisable_app(app=None): """Is this app either oa or alw.""" if app and re.match('^(?:oa|alw)$', app): return True else: return False def is_recognisable_user_id(user_id=None): """Is this a correctly formatted user id string such as oa:123.""" if user_id and re.match('^(?:oa|alw):\d+$', user_id): # noqa return True else: return False