code: def handle_receive_lock_expired(
          channel_state: NettingChannelState,
          state_change: ReceiveLockExpired,
          block_number: BlockNumber,
  ) -> TransitionResult[NettingChannelState]:
      
      is_valid, msg, merkletree = is_valid_lock_expired(
          state_change=state_change,
          channel_state=channel_state,
          sender_state=channel_state.partner_state,
          receiver_state=channel_state.our_state,
          block_number=block_number,
      )
  
      events: List[Event] = list()
      if is_valid:
          assert merkletree, 'is_valid_lock_expired should return merkletree if valid'
          channel_state.partner_state.balance_proof = state_change.balance_proof
          channel_state.partner_state.merkletree = merkletree
  
          _del_unclaimed_lock(channel_state.partner_state, state_change.secrethash)
  
          send_processed = SendProcessed(
              recipient=state_change.balance_proof.sender,
              channel_identifier=CHANNEL_IDENTIFIER_GLOBAL_QUEUE,
              message_identifier=state_change.message_identifier,
          )
          events = [send_processed]
      else:
          assert msg, 'is_valid_lock_expired should return error msg if not valid'
          invalid_lock_expired = EventInvalidReceivedLockExpired(
              secrethash=state_change.secrethash,
              reason=msg,
          )
          events = [invalid_lock_expired]
  
      return TransitionResult(channel_state, events)
docs: Remove expired locks from channel states.