async def METHOD_NAME(app, username, login_id, is_developer, is_service_account):
    db = app['db']
    k8s_client = app['k8s_client']
    @transaction(db)
    async def insert(tx: Transaction) -> Optional[int]:
        row = await tx.execute_and_fetchone('SELECT id, state FROM users where username = %s;', (username,))
        if row:
            if row['state'] == 'active':
                return None
            return row['id']
        hail_credentials_secret_name = f'{username}-gsa-key'
        secret = await k8s_client.read_namespaced_secret(hail_credentials_secret_name, DEFAULT_NAMESPACE)
        credentials_json = base64.b64decode(secret.data['key.json']).decode()
        credentials = json.loads(credentials_json)
        if CLOUD == 'gcp':
            hail_identity = credentials['client_email']
        else:
            assert CLOUD == 'azure'
            hail_identity = credentials['appObjectId']
        if is_developer and SCOPE != 'deploy':
            namespace_name = DEFAULT_NAMESPACE
        else:
            namespace_name = None
        return await tx.execute_insertone(
            '''
    INSERT INTO users (state, username, login_id, is_developer, is_service_account, hail_identity, hail_credentials_secret_name, namespace_name)
    VALUES (%s, %s, %s, %s, %s, %s, %s, %s);
    ''',
            (
                'creating',
                username,
                login_id,
                is_developer,
                is_service_account,
                hail_identity,
                hail_credentials_secret_name,
                namespace_name,
            ),
        )
    return await insert()