def filter_discoveries(discoveries, state=None):
    """ Filter discoveries based on state.

    Parameters
    ----------
    discoveries: list
        List of discoveries to be filtered
    state: str, optional
        Consider only the discoveries to the specified state. Keep all the
        discoveries if the state is not specified

    Returns
    -------
    list
        The discoveries
    """
    if not state:
        return discoveries

    return list(filter(lambda d: d.get('state') == state, discoveries))