list programs that belong to the authenticated user

def list(options):
    """
    list programs that belong to the authenticated user

    """
    configuration = config.get_default()
    app_url = configuration['app_url']

    if options.deployment != None:
        deployment_name = options.deployment
    else:
        deployment_name = configuration['deployment_name']

    client_id = configuration['client_id']
    client_secret = configuration['client_secret']

    token_manager = auth.TokenManager(client_id=client_id,
                                      client_secret=client_secret,
                                      app_url=app_url)

    if options.all == True:
        account_id = None

    else:
        account_id = accounts.get_logged_in_account_id(token_manager=token_manager,
                                                       app_url=app_url)

    programs_details = programs.get_programs(deployment_name,
                                             token_manager=token_manager,
                                             created_by=account_id,
                                             app_url=app_url)

    account_ids = set()
    for program in programs_details:
        account_ids.add(program['createdBy'])

    accounts_details = accounts.get_accounts(account_ids,
                                             token_manager=token_manager,
                                             app_url=app_url)

    account_lookup = {}
    for account in accounts_details['accounts']:
        account_lookup[account['id']] = account

    headers = ['Name', 'Last Saved', 'Created By']
    table = []

    for program in programs_details:
        username = account_lookup[program['createdBy']]['username']
        program_name = program['name']
        last_edited = program['lastEdited']
        table.append([program_name, last_edited, username])

    if options.format == 'table':
        info(tabulate.tabulate(table, headers, tablefmt='orgtbl'))

    elif options.format == 'text':
        info(tabulate.tabulate(table, headers, tablefmt='orgtbl', stralign='center'))

    else:
        raise JutException('Unsupported format "%s"' % options.format)