def natsort_key(s, number_type=int, signed=False, exp=False):
    """\
    Key to sort strings and numbers naturally, not lexicographically.
    It also has basic support for version numbers.
    For use in passing to the :py:func:`sorted` builtin or
    :py:meth:`sort` attribute of lists.

    Use natsort_key just like any other sorting key.

        >>> a = ['num3', 'num5', 'num2']
        >>> a.sort(key=natsort_key)
        >>> a
        ['num2', 'num3', 'num5']

    Below illustrates how the key works, and how the different options affect sorting.

        >>> natsort_key('a-5.034e1')
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=float, signed=True, exp=True)
        ('a', -50.34)
        >>> natsort_key('a-5.034e1', number_type=float, signed=True, exp=False)
        ('a', -5.034, 'e', 1.0)
        >>> natsort_key('a-5.034e1', number_type=float, signed=False, exp=True)
        ('a-', 50.34)
        >>> natsort_key('a-5.034e1', number_type=float, signed=False, exp=False)
        ('a-', 5.034, 'e', 1.0)
        >>> natsort_key('a-5.034e1', number_type=int, signed=True)
        ('a', -5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=int, signed=False)
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=int, exp=False)
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=None)
        ('a-', 5, '.', 34, 'e', 1)

    This is a demonstration of what number_type=None works.

        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=None, signed=False)
        True
        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=None, exp=False)
        True
        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=int, signed=False)
        True

    Iterables are parsed recursively so you can sort lists of lists.

        >>> natsort_key(('a1', 'a10'))
        (('a', 1), ('a', 10))

    Strings that lead with a number get an empty string at the front of the tuple.
    This is designed to get around the "unorderable types" issue.

        >>> natsort_key(('15a', '6'))
        (('', 15, 'a'), ('', 6))

    You can give numbers, too.

        >>> natsort_key(10)
        ('', 10)

    """

    # If we are dealing with non-strings, return now
    if not isinstance(s, six.string_types):
        if hasattr(s, '__getitem__'):
            return tuple(natsort_key(x) for x in s)
        else:
            return ('', s,)

    # Convert to the proper tuple and return
    inp_options = (number_type, signed, exp)
    args = (s,) + regex_and_num_function_chooser[inp_options]
    try:
        return tuple(_number_finder(*args))
    except KeyError:
        # Report errors properly
        if number_type not in (float, int) or number_type is not None:
            raise ValueError("natsort_key: 'number_type' "
                             "parameter '{0}'' invalid".format(str(number_type)))
        elif signed not in (True, False):
            raise ValueError("natsort_key: 'signed' "
                             "parameter '{0}'' invalid".format(str(signed)))
        elif exp not in (True, False):
            raise ValueError("natsort_key: 'exp' "
                             "parameter '{0}'' invalid".format(str(exp)))
\
    Key to sort strings and numbers naturally, not lexicographically.
    It also has basic support for version numbers.
    For use in passing to the :py:func:`sorted` builtin or
    :py:meth:`sort` attribute of lists.

    Use natsort_key just like any other sorting key.

        >>> a = ['num3', 'num5', 'num2']
        >>> a.sort(key=natsort_key)
        >>> a
        ['num2', 'num3', 'num5']

    Below illustrates how the key works, and how the different options affect sorting.

        >>> natsort_key('a-5.034e1')
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=float, signed=True, exp=True)
        ('a', -50.34)
        >>> natsort_key('a-5.034e1', number_type=float, signed=True, exp=False)
        ('a', -5.034, 'e', 1.0)
        >>> natsort_key('a-5.034e1', number_type=float, signed=False, exp=True)
        ('a-', 50.34)
        >>> natsort_key('a-5.034e1', number_type=float, signed=False, exp=False)
        ('a-', 5.034, 'e', 1.0)
        >>> natsort_key('a-5.034e1', number_type=int, signed=True)
        ('a', -5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=int, signed=False)
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=int, exp=False)
        ('a-', 5, '.', 34, 'e', 1)
        >>> natsort_key('a-5.034e1', number_type=None)
        ('a-', 5, '.', 34, 'e', 1)

    This is a demonstration of what number_type=None works.

        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=None, signed=False)
        True
        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=None, exp=False)
        True
        >>> natsort_key('a-5.034e1', number_type=None) == natsort_key('a-5.034e1', number_type=int, signed=False)
        True

    Iterables are parsed recursively so you can sort lists of lists.

        >>> natsort_key(('a1', 'a10'))
        (('a', 1), ('a', 10))

    Strings that lead with a number get an empty string at the front of the tuple.
    This is designed to get around the "unorderable types" issue.

        >>> natsort_key(('15a', '6'))
        (('', 15, 'a'), ('', 6))

    You can give numbers, too.

        >>> natsort_key(10)
        ('', 10)