nodes: 0, module; 1, function_definition; 2, function_name:nested_tuple; 3, parameters; 4, block; 5, identifier:container; 6, expression_statement; 7, if_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, comment:"""Recursively transform a container structure to a nested tuple.
  
      The function understands container types inheriting from the selected abstract base
      classes in `collections.abc`, and performs the following replacements:
      `Mapping`
          `tuple` of key-value pair `tuple`s. The order is preserved in the case of an
          `OrderedDict`, otherwise the key-value pairs are sorted if orderable and
          otherwise kept in the order of iteration.
      `Sequence`
          `tuple` containing the same elements in unchanged order.
      `Container and Iterable and Sized` (equivalent to `Collection` in python >= 3.6)
          `tuple` containing the same elements in sorted order if orderable and otherwise
          kept in the order of iteration.
      The function recurses into these container types to perform the same replacement,
      and leaves objects of other types untouched.
  
      The returned container is hashable if and only if all the values contained in the
      original data structure are hashable.
  
      Parameters
      ----------
      container
          Data structure to transform into a nested tuple.
  
      Returns
      -------
      tuple
          Nested tuple containing the same data as `container`.
  
      """; 12, call; 13, block; 14, call; 15, block; 16, not_operator; 17, block; 18, identifier:container; 19, identifier:isinstance; 20, argument_list; 21, return_statement; 22, identifier:isinstance; 23, argument_list; 24, return_statement; 25, call; 26, if_statement; 27, if_statement; 28, identifier:container; 29, identifier:OrderedDict; 30, call; 31, identifier:container; 32, identifier:Mapping; 33, call; 34, identifier:isinstance; 35, argument_list; 36, call; 37, block; 38, parenthesized_expression; 39, block; 40, identifier:tuple; 41, argument_list; 42, identifier:tuple; 43, argument_list; 44, identifier:container; 45, tuple; 46, identifier:isinstance; 47, argument_list; 48, return_statement; 49, boolean_operator; 50, return_statement; 51, call; 52, call; 53, identifier:str; 54, identifier:bytes; 55, identifier:container; 56, identifier:Sequence; 57, call; 58, boolean_operator; 59, call; 60, call; 61, identifier:map; 62, argument_list; 63, identifier:sorted_if_possible; 64, argument_list; 65, identifier:tuple; 66, argument_list; 67, call; 68, call; 69, identifier:isinstance; 70, argument_list; 71, identifier:tuple; 72, argument_list; 73, identifier:nested_tuple; 74, call; 75, call; 76, call; 77, identifier:isinstance; 78, argument_list; 79, identifier:isinstance; 80, argument_list; 81, identifier:container; 82, identifier:Sized; 83, call; 84, attribute; 85, argument_list; 86, identifier:map; 87, argument_list; 88, identifier:map; 89, argument_list; 90, identifier:container; 91, identifier:Container; 92, identifier:container; 93, identifier:Iterable; 94, identifier:sorted_if_possible; 95, argument_list; 96, identifier:container; 97, identifier:items; 98, identifier:nested_tuple; 99, call; 100, identifier:nested_tuple; 101, identifier:container; 102, call; 103, attribute; 104, argument_list; 105, identifier:map; 106, argument_list; 107, identifier:container; 108, identifier:items; 109, identifier:nested_tuple; 110, identifier:container
code: def nested_tuple(container):
      """Recursively transform a container structure to a nested tuple.
  
      The function understands container types inheriting from the selected abstract base
      classes in `collections.abc`, and performs the following replacements:
      `Mapping`
          `tuple` of key-value pair `tuple`s. The order is preserved in the case of an
          `OrderedDict`, otherwise the key-value pairs are sorted if orderable and
          otherwise kept in the order of iteration.
      `Sequence`
          `tuple` containing the same elements in unchanged order.
      `Container and Iterable and Sized` (equivalent to `Collection` in python >= 3.6)
          `tuple` containing the same elements in sorted order if orderable and otherwise
          kept in the order of iteration.
      The function recurses into these container types to perform the same replacement,
      and leaves objects of other types untouched.
  
      The returned container is hashable if and only if all the values contained in the
      original data structure are hashable.
  
      Parameters
      ----------
      container
          Data structure to transform into a nested tuple.
  
      Returns
      -------
      tuple
          Nested tuple containing the same data as `container`.
  
      """
      if isinstance(container, OrderedDict):
          return tuple(map(nested_tuple, container.items()))
      if isinstance(container, Mapping):
          return tuple(sorted_if_possible(map(nested_tuple, container.items())))
      if not isinstance(container, (str, bytes)):
          if isinstance(container, Sequence):
              return tuple(map(nested_tuple, container))
          if (
              isinstance(container, Container)
              and isinstance(container, Iterable)
              and isinstance(container, Sized)
          ):
              return tuple(sorted_if_possible(map(nested_tuple, container)))
      return container