def is_valid_cidr(string_network):
if string_network.count('<STR_LIT:/>') == <NUM_LIT:1>:<EOL><INDENT>try:<EOL><INDENT>mask = int(string_network.split('<STR_LIT:/>')[<NUM_LIT:1>])<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if mask < <NUM_LIT:1> or mask > <NUM_LIT:32>:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>socket.inet_aton(string_network.split('<STR_LIT:/>')[<NUM_LIT:0>])<EOL><DEDENT>except socket.error:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>
Very simple check of the cidr format in no_proxy variable