Checks whether given object is an ordered mapping,
    e.g. a :class:`OrderedDict`.
    :return: ``True`` if argument is an ordered mapping, ``False`` otherwise

def is_ordered_mapping(obj):
    """Checks whether given object is an ordered mapping,
    e.g. a :class:`OrderedDict`.
    :return: ``True`` if argument is an ordered mapping, ``False`` otherwise
    """
    if not (is_mapping(obj) and hasattr(obj, '__reversed__')):
        return False

    # PyPy has a bug where the standard :class:`dict` has the ``__reversed__``
    # method but it's unusable and throws an exception when called
    try:
        obj.__reversed__()
    except TypeError:
        return False
    else:
        return True