docs: def get_segmentation(recording, annotations, internal_id=None):
      """
      Parameters
      ----------
      recording :
          A HandwrittenData object
      annotations : list of strings
      internal_id : string
          An identifier for the dataset, e.g. 'user1/200922-947-111.ink'.
  
      Returns
      -------
      tuple : segmentation and list of symbol ids (of write-math.com)
      """
      global missing_stroke_segmentation, double_segmentation
      segmentation = []
      symbol_stream = []
      needed = list(range(len(recording)))
      annotations = filter(lambda n: n.startswith('SYMBOL '), annotations)
      for line in annotations:
          tmp = line.split("<")[1]
          tmp, symbol_string = tmp.split(">")
          symbol_string = symbol_string.strip()
          strokes = [int(stroke) for stroke in tmp.split(",")
                     if int(stroke) < len(recording)]
          for el in strokes:
              if el not in needed:
                  double_segmentation.append(internal_id)
                  strokes.remove(el)
                  logging.debug("invalid segmentation by annotation: %s",
                                annotations)
              else:
                  needed.remove(el)
          segmentation.append(strokes)
          symbol_stream.append(datasets.formula_to_dbid(mathbrush_formula_fix(symbol_string), True))
  
      if len(needed) > 0:
          # hw = handwritten_data.HandwrittenData(json.dumps(recording))
          # hw.show()
          missing_stroke_segmentation.append(internal_id)
          segmentation.append(needed)
      return segmentation, symbol_stream