import re


def vm_test_command(vm, cmd, output_test_str):
    """
    Run cmd on vm and verify if output_test_str is in the cmd output
    Returns a `match` object
    """
    vm.sendline(cmd)
    vm.expect("# ")
    return re.search(output_test_str, vm.before)