def reftrack_elementgrp_data(rt, role):
    """Return the data for the elementgrp (e.g. the Assettype or Sequence)

    :param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data
    :type rt: :class:`jukeboxcore.reftrack.Reftrack`
    :param role: item data role
    :type role: QtCore.Qt.ItemDataRole
    :returns: data for the elementgrp
    :rtype: depending on role
    :raises: TypeError
    """
    element = rt.get_element()
    if isinstance(element, djadapter.models.Shot):
        egrp = element.sequence
    elif isinstance(element, djadapter.models.Asset):
        egrp = element.atype
    elif element is not None:
        raise TypeError("Expected the element to be either Asset or Shot. Got %s" % type(element))
    else:
        return
    if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole:
        return egrp.name