code: def deindent(lines, offset=None):
      if offset is None:
          for line in lines:
              line = line.expandtabs()
              s = line.lstrip()
              if s:
                  offset = len(line) - len(s)
                  break
          else:
              offset = 0
      if offset == 0:
          return list(lines)
      newlines = []
  
      def readline_generator(lines):
          for line in lines:
              yield line + "\n"
          while True:
              yield ""
  
      it = readline_generator(lines)
  
      try:
          for (
              _,
              _,
              (sline, _),
              (eline, _),
              _,
          ) in tokenize.generate_tokens(lambda: next(it)):
              if sline > len(lines):
                  break  # End of input reached
              if sline > len(newlines):
                  line = lines[sline - 1].expandtabs()
                  if line.lstrip() and line[:offset].isspace():
                      line = line[offset:]  # Deindent
                  newlines.append(line)
  
              for i in range(sline, eline):
                  # Don't deindent continuing lines of
                  # multiline tokens (i.e. multiline strings)
                  newlines.append(lines[i])
      except (IndentationError, tokenize.TokenError):
          pass
      # Add any lines we didn't see. E.g. if an exception was raised.
      newlines.extend(lines[len(newlines) :])
      return newlines
  
imports: from __future__ import generators
  from bisect import bisect_right
  import sys
  import inspect, tokenize
  import py
  from types import ModuleType
label_desc: Use image node_id 5 for calling a global function with example usage: deindent(lines, offset) and returns: newlines, list