def METHOD_NAME(self, agw_version, unpacked_mconfig):
    # version should be in X.X.X format with only non-negative numbers allowed for X
    version_regex = re.compile(r"[0-9]+\.(?P<minor_version>[0-9]+)\.[0-9]+")
    # unpack the magmad structure to get orce_version field
    if unpacked_mconfig.Is(mconfigs_pb2.MagmaD.DESCRIPTOR):
        magmad_parsed = mconfigs_pb2.MagmaD()
        unpacked_mconfig.Unpack(magmad_parsed)
        orc8r_version = magmad_parsed.orc8r_version
        agw_version_parsed = version_regex.match(agw_version)
        orc8r_version_parsed = version_regex.match(orc8r_version)
        # agw_version is not in expected format
        if not agw_version_parsed:
            logging.warning("Gateway version: %s not valid", agw_version)
        # orc8r_version is not in expected format
        if not orc8r_version_parsed:
            logging.warning("Orchestrator version: %s not valid", orc8r_version)
        return VersionInfo(agw_version_parsed, orc8r_version_parsed)
    logging.error(
        "Expecting MagmaD mconfig structure, but received a different structure: %s.",
        unpacked_mconfig.type_url,
    )
    return VersionInfo(None, None)