def to_uri(uri, base_uri = nil)
      case base_uri
      when nil, ''
        Utils.normalize_uri(uri.to_s)
      else
        Utils.normalize_uri(base_uri) + Utils.normalize_uri(uri.to_s)
      end
    rescue URI::Error
      nil
    end
def to_uri(uri, base_uri = nil)
      case base_uri
      when nil, ''
        Utils.normalize_uri(uri.to_s)
      else
        Utils.normalize_uri(base_uri) + Utils.normalize_uri(uri.to_s)
      end
    rescue URI::Error
      nil
    end
Parse an input into a URI object, optionally resolving it
 against a base URI if given.

 A URI object will have the following properties: scheme,
 userinfo, host, port, registry, path, opaque, query, and
 fragment.