Encoding Technique In Python A Function