def scrape_asset_data(client, asset_id, asset_list):
    """
    Takes an initialized client and an asset_id representing a position in a directory tree.
    Recursively builds a list of assets within the tree.  Returns a list of dicts.
    """
    assets = client.get_asset_children(asset_id)

    for asset in assets:
        # Recurse through folders but skip the empty ones
        if asset['type'] == "folder" and asset != []:
            # Include non-empty folders in the list of scraped assets
            asset_list.append(asset)
            scrape_asset_data(client, asset['id'], asset_list)

        if asset['type'] == "file":
            asset_list.append(asset)

        if asset['type'] == "version_stack":
            # Read about version stacks: https://docs.frame.io/docs/managing-version-stacks
            versions = client.get_asset_children(asset['id'])
            asset_list.append(asset)
            for v_asset in versions:
                asset_list.append(v_asset)

    return asset_list