def get_caption(etype, cell_meta, resources):
    """return an ipypublish caption or False

    captions can either be located at cell_meta.ipub.<type>.caption,
    or at resources.caption[cell_meta.ipub.<type>.label]

    the resources version is proritised
    """
    try:
        caption = cell_meta["ipub"][etype]["caption"]
    except (KeyError, TypeError):
        caption = False

    try:
        label = cell_meta["ipub"][etype]["label"]
    except (KeyError, TypeError):
        label = False

    rcaption = False
    if label:
        try:
            rcaption = resources["caption"][label]
        except (KeyError, TypeError):
            pass

    if rcaption:
        return rcaption
    return caption