<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def attention_builder(name, head_num, activation, history_only, trainable=True):
 """Get multi-head self-attention builder. :param name: Prefix of names for internal layers. :param head_num: Number of heads in multi-head self-attention. :param activation: Activation for multi-head self-attention. :param history_only: Only use history data. :param trainable: Whether the layer is trainable. :return: """

    def _attention_builder(x):
        return MultiHeadAttention(
            head_num=head_num,
            activation=activation,
            history_only=history_only,
            trainable=trainable,
            name=name,
        )(x)
    return _attention_builder