import re


def regex(regex_cmd, output_segment):
    """
    This takes in a regex and command output, and returns a value if found

    :param regex_cmd:
    :param output_segment:
    :return:
    """
    def _regex():
        try:
            return re.search(regex_cmd, output_segment).group(1)
        except Exception as e:
            pass

    return _regex()