code: def export_to_dict(session,
                     recursive,
                     back_references,
                     include_defaults):
      
      logging.info('Starting export')
      dbs = session.query(Database)
      databases = [database.export_to_dict(recursive=recursive,
                   include_parent_ref=back_references,
                   include_defaults=include_defaults) for database in dbs]
      logging.info('Exported %d %s', len(databases), DATABASES_KEY)
      cls = session.query(DruidCluster)
      clusters = [cluster.export_to_dict(recursive=recursive,
                  include_parent_ref=back_references,
                  include_defaults=include_defaults) for cluster in cls]
      logging.info('Exported %d %s', len(clusters), DRUID_CLUSTERS_KEY)
      data = dict()
      if databases:
          data[DATABASES_KEY] = databases
      if clusters:
          data[DRUID_CLUSTERS_KEY] = clusters
      return data
docs: Exports databases and druid clusters to a dictionary