original_docstring: check if string addr is an IP address
docstring: check if string addr is an IP address
docstring_tokens: check if string addr is an IP address
code: def is_ip_addr(addr):
      """check if string addr is an IP address"""
      try:
          addr = addr.get('public_ip_attr', addr.get('private_ip_attr'))
      except AttributeError:
          pass
  
      try:
          ipaddress.ip_address(addr.encode('utf-8'))
      except ValueError:
          return False
      else:
          return True
code_tokens: def is_ip_addr ( addr ) : try : addr = addr . get ( 'public_ip_attr' , addr . get ( 'private_ip_attr' ) ) except AttributeError : pass try : ipaddress . ip_address ( addr . encode ( 'utf-8' ) ) except ValueError : return False else : return True
short_docstring: check if string addr is an IP address
short_docstring_tokens: check if string addr is an IP address
comment: """check if string addr is an IP address"""