hex( string )

Encode a string by converting each byte into a 2-byte hexadecimal representation.

Example
hexed = hex("Hello world!")