def clear_studies(api, account):
    'Delete account studies.\n\n    :param api: api\n    :param account: account\n    '
    account_namespaces = [account.namespace_id]
    group_namespaces = [group.namespace_id for group in api.Group.list(account_id=account.uuid).only(Group.namespace_id).all()]
    account_namespaces.extend(group_namespaces)
    for account_namespace in account_namespaces:
        studies = api.Study.list().filter_by(Filter(field_name='phi_namespace', condition=FilterCondition.equals, value=account_namespace)).all()
        for study in studies:
            study_uid = study.uuid
            logger.error('Remove undeleted study %s', study_uid)
            api.Study.delete(uuid=study_uid).get()
Delete account studies.

:param api: api
:param account: account
def clear_studies(api, account):
    'Delete account studies.\n\n    :param api: api\n    :param account: account\n    '
    account_namespaces = [account.namespace_id]
    group_namespaces = [group.namespace_id for group in api.Group.list(account_id=account.uuid).only(Group.namespace_id).all()]
    account_namespaces.extend(group_namespaces)
    for account_namespace in account_namespaces:
        studies = api.Study.list().filter_by(Filter(field_name='phi_namespace', condition=FilterCondition.equals, value=account_namespace)).all()
        for study in studies:
            study_uid = study.uuid
            logger.error('Remove undeleted study %s', study_uid)
            api.Study.delete(uuid=study_uid).get()