def prepare_input_source(source, base = ""):

    if type(source) in _StringTypes:
        source = xmlreader.InputSource(source)
    elif hasattr(source, "read"):
        f = source
        source = xmlreader.InputSource()
        source.setByteStream(f)
        if hasattr(f, "name"):
            source.setSystemId(absolute_system_id(f.name, base))

    if source.getByteStream() is None:
        sysid = absolute_system_id(source.getSystemId(), base)
        source.setSystemId(sysid)
        f = urllib2.urlopen(sysid)
        source.setByteStream(f)

    return source
This function takes an InputSource and an optional base URL and
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/xml/sax/saxutils.py/prepare_input_source