def _redis_from_dsn(self, dsn):
        """Return a Redis instance from a string DSN."""
        import redis
        parts = urlparse(dsn)
        _, _, netloc = parts.netloc.partition('@')
        netloc = netloc.rsplit(':')
        host = netloc[0]
        try:
            port = int(netloc[1])
        except IndexError:
            port = 6379
        try:
            db = int(parts.path.strip('/'))
        except __HOLE__:
            db = 0
        return redis.Redis(host=host, port=port, db=db)
dataset/ETHPy150Open jdp/taxon/taxon/core.py/RedisTaxon._redis_from_dsn