<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_channelstate_filter( chain_state: ChainState, payment_network_id: PaymentNetworkID, token_address: TokenAddress, filter_fn: Callable, ) -> List[NettingChannelState]: """ Return the state of channels that match the condition in `filter_fn` """

    token_network = get_token_network_by_token_address(
        chain_state,
        payment_network_id,
        token_address,
    )

    result: List[NettingChannelState] = []
    if not token_network:
        return result

    for channel_state in token_network.channelidentifiers_to_channels.values():
        if filter_fn(channel_state):
            result.append(channel_state)

    return result