class_docstr: It is a MongoDB based manager that help you to manage data, network architecture, parameters and logging.
  
  Parameters
  -------------
  ip : str
      Localhost or IP address.
  port : int
      Port number.
  dbname : str
      Database name.
  username : str or None
      User name, set to None if you do not need authentication.
  password : str
      Password.
  project_name : str or None
      Experiment key for this entire project, similar with the repository name of Github.
  
  Attributes
  ------------
  ip, port, dbname and other input parameters : see above
      See above.
  project_name : str
      The given project name, if no given, set to the script name.
  db : mongodb client
      See ``pymongo.MongoClient``.
class_docstr_tok: ["It","is","a","MongoDB","based","manager","that","help","you","to","manage","data",",","network","architecture",",","parameters","and","logging",".","Parameters","--","--","--","--","--","--","-","ip",":","str","Localhost","or","IP","address",".","port",":","int","Port","number",".","dbname",":","str","Database","name",".","username",":","str","or","None","User","name",",","set","to","None","if","you","do","not","need","authentication",".","password",":","str","Password",".","project_name",":","str","or","None","Experiment","key","for","this","entire","project",",","similar","with","the","repository","name","of","Github",".","Attributes","--","--","--","--","--","--","ip",",","port",",","dbname","and","other","input","parameters",":","see","above","See","above",".","project_name",":","str","The","given","project","name",",","if","no","given",",","set","to","the","script","name",".","db",":","mongodb","client","See","``","pymongo.MongoClient","``","."]
docstr: Finds and returns a dataset from the database which matches the requirement.
  
  Parameters
  ----------
  dataset_name : str
      The name of dataset.
  sort : List of tuple
      PyMongo sort comment, search "PyMongo find one sorting" and `collection level operations <http://api.mongodb.com/python/current/api/pymongo/collection.html>`__ for more details.
  kwargs : other events
      Other events, such as description, author and etc (optinal).
  
  Examples
  ---------
  Save dataset
  >>> db.save_dataset([X_train, y_train, X_test, y_test], 'mnist', description='this is a tutorial')
  
  Get dataset
  >>> dataset = db.find_top_dataset('mnist')
  >>> datasets = db.find_datasets('mnist')
  
  Returns
  --------
  dataset : the dataset or False
      Return False if nothing found.
docstr_tok: ["Finds","and","returns","a","dataset","from","the","database","which","matches","the","requirement",".","Parameters","--","--","--","--","--","dataset_name",":","str","The","name","of","dataset",".","sort",":","List","of","tuple","PyMongo","sort","comment",",","search","``","PyMongo","find","one","sorting","''","and","`","collection","level","operations","<","http",":","\/\/api.mongodb.com\/python\/current\/api\/pymongo\/collection.html",">","`","__","for","more","details",".","kwargs",":","other","events","Other","events",",","such","as","description",",","author","and","etc","(","optinal",")",".","Examples","--","--","--","--","-","Save","dataset",">",">",">","db.save_dataset","(","[","X_train",",","y_train",",","X_test",",","y_test","]",",","'mnist","'",",","description='this","is","a","tutorial","'",")","Get","dataset",">",">",">","dataset","=","db.find_top_dataset","(","'mnist","'",")",">",">",">","datasets","=","db.find_datasets","(","'mnist","'",")","Returns","--","--","--","--","dataset",":","the","dataset","or","False","Return","False","if","nothing","found","."]
code: def find_top_dataset(self, dataset_name=None, sort=None, **kwargs):
      """Finds and returns a dataset from the database which matches the requirement.
  
      Parameters
      ----------
      dataset_name : str
          The name of dataset.
      sort : List of tuple
          PyMongo sort comment, search "PyMongo find one sorting" and `collection level operations <http://api.mongodb.com/python/current/api/pymongo/collection.html>`__ for more details.
      kwargs : other events
          Other events, such as description, author and etc (optinal).
  
      Examples
      ---------
      Save dataset
      >>> db.save_dataset([X_train, y_train, X_test, y_test], 'mnist', description='this is a tutorial')
  
      Get dataset
      >>> dataset = db.find_top_dataset('mnist')
      >>> datasets = db.find_datasets('mnist')
  
      Returns
      --------
      dataset : the dataset or False
          Return False if nothing found.
  
      """
  
      self._fill_project_info(kwargs)
      if dataset_name is None:
          raise Exception(
              "dataset_name is None, please give a dataset name"
          )
      kwargs.update({"dataset_name": dataset_name})
  
      s = time.time()
  
      d = self.db.Dataset.find_one(filter=kwargs, sort=sort)
  
      if d is not None:
          dataset_id = d["dataset_id"]
      else:
          print(
              "[Database] FAIL! Cannot find dataset: {}".format(kwargs)
          )
          return False
      try:
          dataset = self._deserialization(
              self.dataset_fs.get(dataset_id).read()
          )
          pc = self.db.Dataset.find(kwargs)
          print(
              "[Database] Find one dataset SUCCESS, {} took: {}s".format(
                  kwargs, round(time.time() - s, 2)
              )
          )
  
          # check whether more datasets match the requirement
          dataset_id_list = pc.distinct("dataset_id")
          n_dataset = len(dataset_id_list)
          if n_dataset != 1:
              print(
                  "     Note that there are {} datasets match the requirement".format(
                      n_dataset
                  )
              )
          return dataset
      except Exception as e:
          exc_type, exc_obj, exc_tb = sys.exc_info()
          fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
          logging.info(
              "{}  {}  {}  {}  {}".format(
                  exc_type, exc_obj, fname, exc_tb.tb_lineno, e
              )
          )
          return False
  
imports: import os
  import pickle
  import sys
  import time
  from datetime import datetime
  import numpy
  import tensorflow
  import gridfs
  import pymongo
  from tensorlayer import logging
  from tensorlayer.files import assign_weights, del_folder, exists_or_mkdir, load_hdf5_to_weights, save_weights_to_hdf5, static_graph2net
label_desc: Use image node_id 10 for calling the TensorHub obj's underlying member method code with example usage: obj.find_top_dataset(dataset_name, sort) and returns: False, dataset, False