def METHOD_NAME(f, parent, parent_name, client):
    tags_check = os.environ["TAGS"]
    account_id_list = get_acc_ids(parent, client)
    for account_id in account_id_list:
        response = client.describe_account(AccountId=account_id)
        account  = response["Account"]          
        if tags_check != '':
            tags_list = list_tags(client, account["Id"]) #gets the lists of tags for this account
            for tag in os.environ.get("TAGS").split(","): #looking at tags in the enviroment variables split by a space
                for org_tag in tags_list:
                    if tag == org_tag['Key']: #if the tag found on the account is the same as the current one in the environent varibles, add it to the data
                        value = org_tag['Value']
                        kv = {tag : value}
                        account.update(kv)
        account.update({'Parent' : parent_name})        
        data = json.dumps(account, default = myconverter) #converts datetime to be able to placed in json
        f.write(data)
        f.write('\n')