I will improve it to:
```
    def GetIpAndPort(np)
      if !np || np.empty?
        return []
      end
      if !np.start_with?("[")
        ret = Builtins.splitstring(np, ":")
      elsif match_data = np.match(/\[([:\w]+)\]:(\d+)/)
        ret = [match_data[1] || "", match_data[2] || ""]
      else
        ret = []
      end
      ret
    end
```