Make a safe path name from uri.

        In the case that uri is already a local path then the
        same path is returned.

def path_from_uri(self, uri):
        """Make a safe path name from uri.

        In the case that uri is already a local path then the
        same path is returned.
        """
        (scheme, netloc, path, params, query, frag) = urlparse(uri)
        if (netloc == ''):
            return(uri)
        path = '/'.join([netloc, path])
        path = re.sub('[^\w\-\.]', '_', path)
        path = re.sub('__+', '_', path)
        path = re.sub('[_\.]+$', '', path)
        path = re.sub('^[_\.]+', '', path)
        return(path)