import re


def run_and_parse_first_match(run_lambda, command, regex):
    """
    Runs command using run_lambda, returns the first regex match if it exists
    """
    rc, out, _ = run_lambda(command)
    if rc != 0:
        return None
    match = re.search(regex, out)
    if match is None:
        return None
    return match.group(1)