import codecs


def str_to_hex(s: str) -> bytes:
    """Convert a string to its' hex representation

    >>> str_to_hex('hello world')
    >>> b'68656c6c6f20776f726c64'

    """
    return codecs.encode(s.encode(), 'hex')