def get_bears_capabilties(bears_by_lang):
    """
    Return a dict of capabilties of all the bears by language
    in the `bears_by_lang` dictionary.

    :param bears_by_lang: dict with language names as keys
                          and the list of bears as values.
    :returns:             dict of capabilities by language.
    """
    result = {}
    for lang, lang_bears in bears_by_lang.items():
        result[lang] = set()
        for bear in lang_bears:
            for cap in (bear.CAN_FIX | bear.CAN_DETECT):
                result[lang].add(cap)
    return result
