import six


def GetDictItems(namedtuple_object):
    """A compatibility function to access the OrdereDict object from the given namedtuple object.

    Args:
        namedtuple_object: namedtuple object.

    Returns:
        collections.namedtuple.__dict__.items() when using python2.
        collections.namedtuple._asdict().items() when using python3.
    """
    return (namedtuple_object.__dict__.items() if six.PY2
            else namedtuple_object._asdict().items())