code: def remove_path_segments(segments, removes):
      
  
      if segments == ['']:
          segments.append('')
      if removes == ['']:
          removes.append('')
  
      if segments == removes:
          ret = []
      elif len(removes) > len(segments):
          ret = segments
      else:
          # TODO(benjamin): incomplete
          removes2 = list(removes)
          if len(removes) > 1 and removes[0] == '':
              removes2.pop(0)
  
          if removes2 and removes2 == segments[-1 * len(removes2):]:
              ret = segments[:len(segments) - len(removes2)]
              if removes[0] != '' and ret:
                  ret.append('')
          else:
              ret = segments
      return ret
docs: Removes the removes from the tail of segments.
  
      Examples::
          >>> # '/a/b/c' - 'b/c' == '/a/'
          >>> assert remove_path_segments(['', 'a', 'b', 'c'], ['b', 'c']) == ['', 'a', '']
          >>> # '/a/b/c' - '/b/c' == '/a
          >>> assert remove_path_segments(['', 'a', 'b', 'c'], ['', 'b', 'c']) == ['', 'a']
  
      :param segments:  :class:`list`, a list of the path segment
      :param removes:  :class:`list`, a list of the path segment
      :return:  :class:`list`, The list of all remaining path segments after all segments
          in ``removes`` have been removed from the end of ``segments``. If no segment
          from ``removes`` were removed from the ``segments``, the ``segments`` is
          return unmodified.