code: def join_path_segments(*args):
      
      finals = []
      for segments in args:
          if not segments or segments[0] == ['']:
              continue
          elif not finals:
              finals.extend(segments)
          else:
              # Example #1: ['a',''] + ['b'] == ['a','b']
              # Example #2: ['a',''] + ['','b'] == ['a','','b']
              if finals[-1] == '' and (segments[0] != '' or len(segments) > 1):
                  finals.pop(-1)
              # Example: ['a'] + ['','b'] == ['a','b']
              elif finals[-1] != '' and segments[0] == '' and len(segments) > 1:
                  segments.pop(0)
              finals.extend(segments)
      return finals
docs: Join multiple list of path segments
  
      This function is not encoding aware, it does not test for, or changed the
      encoding of the path segments it's passed.
  
      Example::
          >>> assert join_path_segments(['a'], ['b']) == ['a','b']
          >>> assert join_path_segments(['a',''], ['b']) == ['a','b']
          >>> assert join_path_segments(['a'], ['','b']) == ['a','b']
          >>> assert join_path_segments(['a',''], ['','b']) == ['a','','b']
          >>> assert join_path_segments(['a','b'], ['c','d']) == ['a','b','c','d']
  
      :param args: optional  arguments
      :return: :class:`list`, the segment list of the result path