def METHOD_NAME(op_str, running_version, version_str, as_hex=False):
    operators = {
        '==': operator.eq,
        '!=': operator.ne,
        '>=': operator.ge,
        '<=': operator.le,
        '>': operator.gt,
        '<': operator.lt,
    }
    op = operators[op_str]
    major, minor, patch = (int(e) for e in version_str.split('.'))
    if as_hex:
        version = (major << 16) | (minor << 8) | patch
    else:
        version = (major, minor, patch)
    return op(running_version, version)