def METHOD_NAME(cursor, user_id, username):
    print()
    print(f'User {username} (ID={user_id}):')
    try:
        cursor.execute(
            'SELECT corpus_name FROM kontext_user_access WHERE user_id = %s', (user_id,))
        print('  individual access to:\n    {}'.format(
            ', '.join(row['corpus_name'] for row in cursor.fetchall())))
        cursor.execute(
            'SELECT corpus_name FROM kontext_group_access kga '
            'JOIN kontext_user AS ku ON ku.group_access = kga.group_access '
            'WHERE ku.id = %s', (user_id,)
        )
        print('  group access to:\n    {}'.format(
            ', '.join(row['corpus_name'] for row in cursor.fetchall())))
    except Exception as ex:
        print(ex)