def METHOD_NAME(text):
  # The idea:
  # - Look at the first non-empty line
  # - Capture the leading whitespace prefix for that line
  # - Strip it from all the other lines uniformly
  lines = list(isplitlines(text))
  if not lines:
    return text
  ws_prefix = None
  for line in lines:
    if is_empty(line):
      continue
    ws_prefix = re.match(r'^\s*', line).group(0)
    break
  if ws_prefix:
    lines = map(
      lambda line: line[len(ws_prefix):] if line.startswith(ws_prefix) else line,
      lines,
    )
  return '\n'.join(lines)