docs: def cleanup_lines( lines, **kwargs ):
      ''' Cleans up annotation after syntactic pre-processing and processing:
          -- Removes embedded clause boundaries "<{>" and "<}>";
          -- Removes CLBC markings from analysis;
          -- Removes additional information between < and > from analysis;
          -- Removes additional information between " and " from analysis;
          -- If remove_caps==True , removes 'cap' annotations from analysis;
          -- If remove_clo==True , removes CLO CLC CLB markings from analysis;
          -- If double_quotes=='esc'   then "   will be overwritten with \\";
             and 
             if double_quotes=='unesc' then \\" will be overwritten with ";
          -- If fix_sent_tags=True, then sentence tags (<s> and </s>) will be
             checked for mistakenly added analysis, and found analysis will be
             removed;
          
          Returns the input list, which has been cleaned from additional information;
      '''
      if not isinstance( lines, list ):
          raise Exception('(!) Unexpected type of input argument! Expected a list of strings.')
      remove_caps   = False
      remove_clo    = False
      double_quotes = None
      fix_sent_tags = False
      for argName, argVal in kwargs.items() :
          if argName in ['remove_caps', 'remove_cap']:
             remove_caps = bool(argVal)
          if argName == 'remove_clo':
             remove_clo = bool(argVal)
          if argName == 'fix_sent_tags':
             fix_sent_tags = bool(argVal)
          if argName in ['double_quotes', 'quotes'] and argVal and \
             argVal.lower() in ['esc', 'escape', 'unesc', 'unescape']:
             double_quotes = argVal.lower()
      pat_token_line     = re.compile('^"<(.+)>"\s*$')
      pat_analysis_start = re.compile('^(\s+)"(.+)"(\s[LZT].*)$')
      i = 0
      to_delete = []
      while ( i < len(lines) ):
          line = lines[i]
          isAnalysisLine = line.startswith('  ') or line.startswith('\t')
          if not isAnalysisLine:
             removeCurrentTokenAndAnalysis = False
             #  1) Remove embedded clause boundaries "<{>" and "<}>"
             if line.startswith('"<{>"'):
                if i+1 == len(lines) or (i+1 < len(lines) and not '"{"' in lines[i+1]):
                   removeCurrentTokenAndAnalysis = True
             if line.startswith('"<}>"'):
                if i+1 == len(lines) or (i+1 < len(lines) and not '"}"' in lines[i+1]):
                   removeCurrentTokenAndAnalysis = True
             if removeCurrentTokenAndAnalysis:
                # Remove the current token and all the subsequent analyses
                del lines[i]
                j=i
                while ( j < len(lines) ):
                   line2 = lines[j]
                   if line2.startswith('  ') or line2.startswith('\t'):
                      del lines[j]
                   else:
                      break
                continue
             #  2) Convert double quotes (if required)
             if double_quotes:
                #  '^"<(.+)>"\s*$'
                if pat_token_line.match( lines[i] ):
                   token_cleaned = (pat_token_line.match(lines[i])).group(1)
                   # Escape or unescape double quotes
                   if double_quotes in ['esc', 'escape']:
                      token_cleaned = token_cleaned.replace('"', '\\"')
                      lines[i] = '"<'+token_cleaned+'>"'
                   elif double_quotes in ['unesc', 'unescape']:
                      token_cleaned = token_cleaned.replace('\\"', '"')
                      lines[i] = '"<'+token_cleaned+'>"'
          else:
             #  Normalize analysis line
             lines[i] = re.sub('^\s{4,}', '\t', lines[i])
             #  Remove clause boundary markings
             lines[i] = re.sub('(.*)" ([LZT].*) CLBC (.*)', '\\1" \\2 \\3', lines[i])
             #  Remove additional information that was added during the analysis
             lines[i] = re.sub('(.*)" L([^"<]*) ["<]([^@]*) (@.*)', '\\1" L\\2 \\4', lines[i]) 
             #  Remove 'cap' tags
             if remove_caps:
                lines[i] = lines[i].replace(' cap ', ' ')
             #  Convert double quotes (if required)
             if double_quotes and double_quotes in ['unesc', 'unescape']:
                lines[i] = lines[i].replace('\\"', '"')
             elif double_quotes and double_quotes in ['esc', 'escape']:
                m = pat_analysis_start.match( lines[i] )
                if m:
                   # '^(\s+)"(.+)"(\s[LZT].*)$'
                   start   = m.group(1)
                   content = m.group(2)
                   end     = m.group(3)
                   content = content.replace('"', '\\"')
                   lines[i] = ''.join([start, '"', content, '"', end])
             #  Remove CLO CLC CLB markings
             if remove_clo and 'CL' in lines[i]:
                lines[i] = re.sub('\sCL[OCB]', ' ', lines[i])
                lines[i] = re.sub('\s{2,}', ' ', lines[i])
             #  Fix sentence tags that mistakenly could have analysis (in EDT corpus)
             if fix_sent_tags:
                if i-1 > -1 and ('"</s>"' in lines[i-1] or '"<s>"' in lines[i-1]):
                   lines[i] = ''
          i += 1
      return lines