def resolve_ecodes(ecode_dict, ecode_list, unknown='?'):
    """
    Resolve event codes and types to their verbose names.

    Example
    -------
    >>> resolve_ecodes([272, 273, 274])
    [('BTN_MOUSE',  272), ('BTN_RIGHT',  273), ('BTN_MIDDLE', 274)]
    """
    res = []
    for ecode in ecode_list:
        if isinstance(ecode, tuple):
            if ecode[0] in ecode_dict:
                l = (ecode_dict[ecode[0]], ecode[0]), ecode[1]
            else:
                l = (unknown, ecode[0]), ecode[1]
        elif ecode in ecode_dict:
            l = ecode_dict[ecode], ecode
        else:
            l = unknown, ecode
        res.append(l)
    return res
