nodes: 0, module; 1, function_definition; 2, function_name:natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:key; 13, None; 14, identifier:reverse; 15, False; 16, identifier:alg; 17, attribute; 18, comment:"""
      Sorts an iterable naturally.
  
      Parameters
      ----------
      seq : iterable
          The input to sort.
  
      key : callable, optional
          A key used to determine how to sort each element of the iterable.
          It is **not** applied recursively.
          It should accept a single argument and return a single value.
  
      reverse : {{True, False}}, optional
          Return the list in reversed sorted order. The default is
          `False`.
  
      alg : ns enum, optional
          This option is used to control which algorithm `natsort`
          uses when sorting. For details into these options, please see
          the :class:`ns` class documentation. The default is `ns.INT`.
  
      Returns
      -------
      out: list
          The sorted input.
  
      See Also
      --------
      natsort_keygen : Generates the key that makes natural sorting possible.
      realsorted : A wrapper for ``natsorted(seq, alg=ns.REAL)``.
      humansorted : A wrapper for ``natsorted(seq, alg=ns.LOCALE)``.
      index_natsorted : Returns the sorted indexes from `natsorted`.
  
      Examples
      --------
      Use `natsorted` just like the builtin `sorted`::
  
          >>> a = ['num3', 'num5', 'num2']
          >>> natsorted(a)
          [{u}'num2', {u}'num3', {u}'num5']
  
      """; 19, assignment; 20, call; 21, identifier:ns; 22, identifier:DEFAULT; 23, identifier:key; 24, call; 25, identifier:sorted; 26, argument_list; 27, identifier:natsort_keygen; 28, argument_list; 29, identifier:seq; 30, keyword_argument; 31, keyword_argument; 32, identifier:key; 33, identifier:alg; 34, identifier:reverse; 35, identifier:reverse; 36, identifier:key; 37, identifier:key
code: def natsorted(seq, key=None, reverse=False, alg=ns.DEFAULT):
      """
      Sorts an iterable naturally.
  
      Parameters
      ----------
      seq : iterable
          The input to sort.
  
      key : callable, optional
          A key used to determine how to sort each element of the iterable.
          It is **not** applied recursively.
          It should accept a single argument and return a single value.
  
      reverse : {{True, False}}, optional
          Return the list in reversed sorted order. The default is
          `False`.
  
      alg : ns enum, optional
          This option is used to control which algorithm `natsort`
          uses when sorting. For details into these options, please see
          the :class:`ns` class documentation. The default is `ns.INT`.
  
      Returns
      -------
      out: list
          The sorted input.
  
      See Also
      --------
      natsort_keygen : Generates the key that makes natural sorting possible.
      realsorted : A wrapper for ``natsorted(seq, alg=ns.REAL)``.
      humansorted : A wrapper for ``natsorted(seq, alg=ns.LOCALE)``.
      index_natsorted : Returns the sorted indexes from `natsorted`.
  
      Examples
      --------
      Use `natsorted` just like the builtin `sorted`::
  
          >>> a = ['num3', 'num5', 'num2']
          >>> natsorted(a)
          [{u}'num2', {u}'num3', {u}'num5']
  
      """
      key = natsort_keygen(key, alg)
      return sorted(seq, reverse=reverse, key=key)