docs: def write_separated_lines(path, values, separator=' ', sort_by_column=0):
      """
      Writes list or dict to file line by line. Dict can have list as value then they written
      separated on the line.
  
      Parameters:
          path (str): Path to write file to.
          values (dict, list): A dictionary or a list to write to the file.
          separator (str): Separator to use between columns.
          sort_by_column (int): if >= 0, sorts the list by the given index, if its 0 or 1 and its a
                                dictionary it sorts it by either the key (0) or value (1). By default
                                0, meaning sorted by the first column or the key.
      """
      f = open(path, 'w', encoding='utf-8')
  
      if type(values) is dict:
          if sort_by_column in [0, 1]:
              items = sorted(values.items(), key=lambda t: t[sort_by_column])
          else:
              items = values.items()
  
          for key, value in items:
              if type(value) in [list, set]:
                  value = separator.join([str(x) for x in value])
  
              f.write('{}{}{}\n'.format(key, separator, value))
      elif type(values) is list or type(values) is set:
          if 0 <= sort_by_column < len(values):
              items = sorted(values)
          else:
              items = values
  
          for record in items:
              str_values = [str(value) for value in record]
  
              f.write('{}\n'.format(separator.join(str_values)))
  
      f.close()