<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def button_released(self, key_code, prefix=None):
 """ Called from the controller classes to update the state of this button manager when a button is released. :internal: :param key_code: The code specified when populating Button instance :param prefix: Applied to key code if present """

        if prefix is not None:
            state = self.buttons_by_code.get(prefix + str(key_code))
        else:
            state = self.buttons_by_code.get(key_code)
        if state is not None:
            state.is_pressed = False
            state.last_pressed = None