def is_valid_ip(ip_address, project):
 blacklist = project.get_option('sentry:blacklisted_ips')
 if (not blacklist):
  return True
 for addr in blacklist:
  if (ip_address == addr):
   return False
  if (('/' in addr) and (ipaddress.ip_address(six.text_type(ip_address)) in ipaddress.ip_network(six.text_type(addr), strict=False))):
   return False
 return True

def is_valid_ip ( ip_address , project ) : blacklist = project . get_option ( 'sentry:blacklisted_ips' ) if ( not blacklist ) : return True for addr in blacklist : if ( ip_address == addr ) : return False if ( ( '/' in addr ) and ( ipaddress . ip_address ( six . text_type ( ip_address ) ) in ipaddress . ip_network ( six . text_type ( addr ) , strict = False ) ) ) : return False return True
check validity of an ip address .