<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def redis_from_url(url):
 """ Converts a redis URL used by celery into a `redis.Redis` object. """

    # Makes sure that we only try to import redis when we need
    # to use it
    import redis

    url = url or ""
    parsed_url = urlparse(url)
    if parsed_url.scheme != "redis":
        return None

    kwargs = {}
    match = PASS_HOST_PORT.match(parsed_url.netloc)
    if match.group('password') is not None:
        kwargs['password'] = match.group('password')
    if match.group('host') is not None:
        kwargs['host'] = match.group('host')
    if match.group('port') is not None:
        kwargs['port'] = int(match.group('port'))

    if len(parsed_url.path) > 1:
        # Removes "/" from the beginning
        kwargs['db'] = int(parsed_url.path[1:])

    return redis.StrictRedis(**kwargs)