i have a little problem with my script, where i need to convert ip in form \'xxx.xxx.xxx.xxx\' to integer representation and go back from this form.
def ipto
You lose the left-zero-padding which breaks decoding of your string.
Here's a working function:
def inttoip(ip): return socket.inet_ntoa(hex(ip)[2:].zfill(8).decode('hex'))