def _infer_return_type(*args):
 return_type = None
 for arg in args:
  if (arg is None):
   continue
  if isinstance(arg, bytes):
   if (return_type is str):
    raise TypeError("Can't mix bytes and non-bytes in path components.")
   return_type = bytes
  else:
   if (return_type is bytes):
    raise TypeError("Can't mix bytes and non-bytes in path components.")
   return_type = str
 if (return_type is None):
  return str
 return return_type

def _infer_return_type ( * args ) : return_type = None for arg in args : if ( arg is None ) : continue if isinstance ( arg , bytes ) : if ( return_type is str ) : raise TypeError ( "Can't mix bytes and non-bytes in path components." ) return_type = bytes else : if ( return_type is bytes ) : raise TypeError ( "Can't mix bytes and non-bytes in path components." ) return_type = str if ( return_type is None ) : return str return return_type
look at the type of all args and divine their implied return type .