def ntob(n, encoding='ISO-8859-1'):
    """Convert a native :class:`str` to a :class:`bytes` instance.

    The encoding can be changed to non-ASCII optionally.
    """
    assert_native(n)
    # In Python 3, the native string type is unicode
    return n.encode(encoding)
Convert a native :class:`str` to a :class:`bytes` instance.

    The encoding can be changed to non-ASCII optionally.
    
cherrypy/_cpcompat.py