def _keys(duthost, db, key_pattern):
    """Run Redis command keys over db on duthost."""
    command = "redis-cli --raw -n {db} keys '{key_pattern}'".format(db=db, key_pattern=key_pattern)
    keys_result = duthost.shell(command)
    if not keys_result["stdout"].strip():
        raise ValueError("No keys match key pattern {}".format(key_pattern))
    return [line.strip() for line in keys_result["stdout_lines"]]