code: def split_semicolon(line, maxsplit=None):
      r
      # Split on ';' character
      split_line = line.split(';')
  
      split_line_size = len(split_line)
  
      # if maxsplit is not specified, we set it to the number of part
      if maxsplit is None or maxsplit < 0:
          maxsplit = split_line_size
  
      # Join parts  to the next one, if ends with a '\'
      # because we mustn't split if the semicolon is escaped
      i = 0
      while i < split_line_size - 1:
  
          # for each part, check if its ends with a '\'
          ends = split_line[i].endswith('\\')
  
          if ends:
              # remove the last character '\'
              split_line[i] = split_line[i][:-1]
  
          # append the next part to the current if it is not the last and the current
          # ends with '\' or if there is more than maxsplit parts
          if (ends or i >= maxsplit) and i < split_line_size - 1:
  
              split_line[i] = ";".join([split_line[i], split_line[i + 1]])
  
              # delete the next part
              del split_line[i + 1]
              split_line_size -= 1
  
          # increase i only if we don't have append because after append the new
          # string can end with '\'
          else:
              i += 1
  
      return split_line
docs: r"""Split a line on semicolons characters but not on the escaped semicolons
  
      :param line: line to split
      :type line: str
      :param maxsplit: maximal number of split (if None, no limit)
      :type maxsplit: None | int
      :return: split line
      :rtype: list
  
      >>> split_semicolon('a,b;c;;g')
      ['a,b', 'c', '', 'g']
  
      >>> split_semicolon('a,b;c;;g', 2)
      ['a,b', 'c', ';g']
  
      >>> split_semicolon(r'a,b;c\;;g', 2)
      ['a,b', 'c;', 'g']