def METHOD_NAME(level, timestamp=None, file_and_line=None):
  """Generate a nndct logline prefix."""
  # pylint: disable=global-variable-not-assigned
  global _level_names
  # pylint: enable=global-variable-not-assigned
  # Record current time
  now = timestamp or _time.time()
  now_tuple = _time.localtime(now)
  now_microsecond = int(1e6 * (now % 1.0))
  (filename, line) = file_and_line or _get_file_and_line()
  basename = _os.path.basename(filename)
  # Severity string
  severity = 'I'
  if level in _level_names:
    severity = _level_names[level][0]
  # TODO(yuwang): Format by environment variable.
  s = '%c%02d%02d %02d:%02d:%02d %s:%d]' % (
      severity,
      now_tuple[1],  # month
      now_tuple[2],  # day
      now_tuple[3],  # hour
      now_tuple[4],  # min
      now_tuple[5],  # sec
      basename,
      line)
  return s