def get_filtered_rules(client, pattern):
    """ Returns a printout of all rules that contain the given pattern """
    all_rules = client.execute_command("p").split("\n")
    return "".join(client.execute_command("p " + rule_name) for rule_name in all_rules 
            if pattern in rule_name)