import pickle


def get_challenge_by_channel_id(database, challenge_channel_id):
    """
    Fetch a Challenge object in the database with a given channel ID
    Return the matching Challenge object if found, or None otherwise.
    """
    ctfs = pickle.load(open(database, "rb"))
    for ctf in ctfs:
        for challenge in ctf.challenges:
            if challenge.channel_id == challenge_channel_id:
                return challenge

    return None