<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _remove_keycache(self, entity_branch, turn, tick):
 """Remove the future of a given entity from a branch in the keycache"""

        keycache = self.keycache
        if entity_branch in keycache:
            kc = keycache[entity_branch]
            if turn in kc:
                kcturn = kc[turn]
                if tick in kcturn:
                    del kcturn[tick]
                kcturn.truncate(tick)
                if not kcturn:
                    del kc[turn]
            kc.truncate(turn)
            if not kc:
                del keycache[entity_branch]