<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_badge_messages(self, badge_award):
 """ If the Badge class defines a message, send it to the user who was just awarded the badge. """

        user_message = getattr(badge_award.badge, "user_message", None)
        if callable(user_message):
            message = user_message(badge_award)
        else:
            message = user_message
        if message is not None:
            badge_award.user.message_set.create(message=message)