def METHOD_NAME(lhs, rhs, binary_op):
    name = "{}_{}_{}".format(lhs, binary_op, rhs)
    docstring = """Builtin message function that computes a message on an edge
    by performing element-wise {} between features of {} and {}
    if the features have the same shape; otherwise, it first broadcasts the features
    to a new shape and performs the element-wise operation.
    Broadcasting follows NumPy semantics. Please see
    https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
    for more details about the NumPy broadcasting semantics.
    Parameters
    ----------
    lhs_field : str
        The feature field of {}.
    rhs_field : str
        The feature field of {}.
    out : str
        The output message field.
    Examples
    --------
    >>> import dgl
    >>> message_func = dgl.function.{}('h', 'h', 'm')
    """.format(
        binary_op,
        TargetCode.CODE2STR[_TARGET_MAP[lhs]],
        TargetCode.CODE2STR[_TARGET_MAP[rhs]],
        TargetCode.CODE2STR[_TARGET_MAP[lhs]],
        TargetCode.CODE2STR[_TARGET_MAP[rhs]],
        name,
    )
    def func(lhs_field, rhs_field, out):
        return BinaryMessageFunction(
            binary_op,
            _TARGET_MAP[lhs],
            _TARGET_MAP[rhs],
            lhs_field,
            rhs_field,
            out,
        )
    func.__name__ = name
    func.__doc__ = docstring
    return func