Create a logger object with the given name.

  If this is the first time that we call this method, then initialize the
  formatter.

def create_logger(name):
  """
  Create a logger object with the given name.

  If this is the first time that we call this method, then initialize the
  formatter.
  """
  base = logging.getLogger("cleverhans")
  if len(base.handlers) == 0:
    ch = logging.StreamHandler()
    formatter = logging.Formatter('[%(levelname)s %(asctime)s %(name)s] ' +
                                  '%(message)s')
    ch.setFormatter(formatter)
    base.addHandler(ch)

  return base