code: def ip_to_bytes(ip_str, big_endian=True):
      
      if big_endian:
          code = '>L'
      else:
          code = '<L'
      return bytes(struct.unpack(code, socket.inet_aton(ip_str))[0])
docs: Converts an IP given as a string to a byte sequence