def _get_title(dgroup, title=None):
    """get best title for group"""
    if title is not None:
        return title
    data_group = getattr(dgroup, 'data', None)
    for attr in ('title', 'plot_title', 'filename', 'name', '__name__'):
        t = getattr(dgroup, attr, None)
        if t is not None:
            return t
        if data_group is not None:
            t = getattr(data_group, attr, None)
            if t is not None:
                return t
    return repr(dgroup)
