code: def collapse_indents(indentation):
      
      change_in_level = ind_change(indentation)
      if change_in_level == 0:
          indents = ""
      elif change_in_level < 0:
          indents = closeindent * (-change_in_level)
      else:
          indents = openindent * change_in_level
      return indentation.replace(openindent, "").replace(closeindent, "") + indents
docs: Removes all openindent-closeindent pairs.