code: def _sequence_like(instance, args):
      """Converts the sequence `args` to the same type as `instance`.
  
      Args:
        instance: an instance of `tuple`, `list`, `namedtuple`, `dict`, or
          `collections.OrderedDict`.
        args: elements to be converted to the `instance` type.
  
      Returns:
        `args` with the type of `instance`.
      """
      if isinstance(instance, (dict, collections_abc.Mapping)):
          # Pack dictionaries in a deterministic order by sorting the keys.
          # Notice this means that we ignore the original order of `OrderedDict`
          # instances. This is intentional, to avoid potential bugs caused by mixing
          # ordered and plain dicts (e.g., flattening a dict but using a
          # corresponding `OrderedDict` to pack it back).
          result = dict(zip(_sorted(instance), args))
          keys_and_values = ((key, result[key]) for key in instance)
          if isinstance(instance, collections.defaultdict):
              # `defaultdict` requires a default factory as the first argument.
              return type(instance)(
                  instance.default_factory, keys_and_values
              )
          elif isinstance(instance, types.MappingProxyType):
              # MappingProxyType requires a dict to proxy to.
              return type(instance)(dict(keys_and_values))
          else:
              return type(instance)(keys_and_values)
      elif isinstance(instance, collections_abc.MappingView):
          # We can't directly construct mapping views, so we create a list instead
          return list(args)
      elif _is_namedtuple(instance):
          if isinstance(instance, ObjectProxy):
              instance_type = type(instance.__wrapped__)
          else:
              instance_type = type(instance)
          return instance_type(*args)
      elif isinstance(instance, ObjectProxy):
          # For object proxies, first create the underlying type and then re-wrap it
          # in the proxy type.
          return type(instance)(
              _sequence_like(instance.__wrapped__, args)
          )
      else:
          # Not a namedtuple
          return type(instance)(args)
  
imports: import collections
  from collections import abc
  import types
  import tree
label_desc: Use image node_id 14 for calling a global function with example usage: _sequence_like(instance, args) and returns: type, list, type, type, instance_type, type, type