def make_amazon(folder, accounts_location=None, dry_run=False): """Find the account we're using and return a setup Amazon object""" if not accounts_location: accounts_location = os.path.join(folder, '..', 'accounts.yaml') accounts = accounts_from(accounts_location) account_name = os.path.basename(folder) if account_name not in accounts: raise SyncrError("Please add this account to accounts.yaml", accounts_yaml_location=accounts_location, account_name=account_name) account_id = accounts[account_name] amazon = Amazon(account_id, account_name, accounts, dry_run=dry_run) amazon.setup() return amazon