<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def account_setup(remote, token=None, response=None, account_setup=None):
 """Setup user account."""

    gh = GitHubAPI(user_id=token.remote_account.user_id)
    with db.session.begin_nested():
        gh.init_account()

        # Create user <-> external id link.
        oauth_link_external_id(
            token.remote_account.user,
            dict(id=str(gh.account.extra_data['id']), method="github")
        )