def check_ip(original_ip):
ip = original_ip.strip()<EOL>parts = ip.split('<STR_LIT:.>')<EOL>if len(parts) != <NUM_LIT:4>:<EOL><INDENT>return None<EOL><DEDENT>for p in parts:<EOL><INDENT>try:<EOL><INDENT>p = int(p)<EOL>if (p < <NUM_LIT:0>) or (p > <NUM_LIT:255>):<EOL><INDENT>return None<EOL><DEDENT><DEDENT>except:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>return ip<EOL>
Checks the format of an IP address and returns it if it is correct. Otherwise it returns None.