code: def _mixed_join(iterable, sentinel):
      
      iterator = iter(iterable)
      first_item = next(iterator, sentinel)
      if isinstance(first_item, bytes):
          return first_item + b''.join(iterator)
      return first_item + u''.join(iterator)
docs: concatenate any string type in an intelligent way.