def METHOD_NAME(name, user, location_pid, scopes, internal,
                    access_token, comments):
    """Create a personal OAuth token."""
    # avoid circular import
    from rero_ils.modules.cli.utils import create_personal
    # check if user exist:
    if not user:
        click.secho('ERROR user does not exist', fg='red')
        sys.exit(1)
    # check if name already exist
    if SelfcheckTerminal.find_terminal(name=name):
        click.secho(
            f'ERROR terminal name already exist: {name}',
            fg='red'
        )
        sys.exit(1)
    if location := LocationsSearch().get_record_by_pid(location_pid):
        if not (token := get_token(access_token=access_token)):
            click.secho(f'create token for: {user}', fg='blue')
            token = create_personal(
                name, user.id, scopes=scopes, is_internal=internal,
                access_token=access_token)
            access_token = token.access_token
        if access_token:
            selfcheck_terminal = SelfcheckTerminal(
                name=name,
                access_token=access_token,
                organisation_pid=location.organisation['pid'],
                library_pid=location.library['pid'],
                location_pid=location_pid,
                comments=comments
            )
            db.session.add(selfcheck_terminal)
            db.session.commit()
        click.secho(f'login: {name}', fg='green')
        click.secho(f'token: {access_token}', fg='green')