def remote_entries(entries, options_map):
    '\n\n    @param entries:\n    @param options_map:\n    @return:\n    '
    errors = []
    settings = options_map['coolbeans']
    secrets_file = get_setting('google-apis', settings)
    connection = google_connect(secrets_file)
    new_entries_path = None
    new_entries_file = get_setting('new-entries-bean', settings)
    if new_entries_file:
        new_entries_path = pathlib.Path(new_entries_file)
    remote_accounts = {}
    for entry in entries:
        if (not isinstance(entry, data.Open)):
            continue
        document_name = entry.meta.get('document_name', None)
        default_currency = (entry.currencies[0] if entry.currencies else DEFAULT_CURRENCY)
        if document_name:
            options = dict(document_name=document_name, document_tab=entry.meta.get('document_tab', None), reverse_amount=entry.meta.get('reverse', False), default_currency=default_currency, entry=entry, entry_file=new_entries_path)
            remote_accounts[entry.account] = options
    new_entries = []
    for (account, options) in remote_accounts.items():
        try:
            new_entries += load_remote_account(connection=connection, errors=errors, account=account, options=options)
        except Exception as exc:
            logger.error(f'while processing {account}', exc_info=exc)
    if (new_entries and new_entries_path):
        from beancount.parser import printer
        with new_entries_path.open('w') as stream:
            printer.print_entries(new_entries, file=stream)
            logger.info(f'Wrote {len(new_entries)} new account(s) to {new_entries_path}.')
    return ((entries + new_entries), errors)
@param entries:
@param options_map:
@return:
def remote_entries(entries, options_map):
    '\n\n    @param entries:\n    @param options_map:\n    @return:\n    '
    errors = []
    settings = options_map['coolbeans']
    secrets_file = get_setting('google-apis', settings)
    connection = google_connect(secrets_file)
    new_entries_path = None
    new_entries_file = get_setting('new-entries-bean', settings)
    if new_entries_file:
        new_entries_path = pathlib.Path(new_entries_file)
    remote_accounts = {}
    for entry in entries:
        if (not isinstance(entry, data.Open)):
            continue
        document_name = entry.meta.get('document_name', None)
        default_currency = (entry.currencies[0] if entry.currencies else DEFAULT_CURRENCY)
        if document_name:
            options = dict(document_name=document_name, document_tab=entry.meta.get('document_tab', None), reverse_amount=entry.meta.get('reverse', False), default_currency=default_currency, entry=entry, entry_file=new_entries_path)
            remote_accounts[entry.account] = options
    new_entries = []
    for (account, options) in remote_accounts.items():
        try:
            new_entries += load_remote_account(connection=connection, errors=errors, account=account, options=options)
        except Exception as exc:
            logger.error(f'while processing {account}', exc_info=exc)
    if (new_entries and new_entries_path):
        from beancount.parser import printer
        with new_entries_path.open('w') as stream:
            printer.print_entries(new_entries, file=stream)
            logger.info(f'Wrote {len(new_entries)} new account(s) to {new_entries_path}.')
    return ((entries + new_entries), errors)