Used by _get_next_child_node, this method is called to find next possible parent.
            For example if timeperiod 2011010200 has all children processed, but is not yet processed itself
            then it makes sense to look in 2011010300 for hourly nodes

def _get_next_parent_node(self, parent):
        """ Used by _get_next_child_node, this method is called to find next possible parent.
            For example if timeperiod 2011010200 has all children processed, but is not yet processed itself
            then it makes sense to look in 2011010300 for hourly nodes """
        grandparent = parent.parent
        if grandparent is None:
            # here, we work at yearly/linear level
            return None

        parent_siblings = list(grandparent.children)
        sorted_keys = sorted(parent_siblings)
        index = sorted_keys.index(parent.timeperiod)
        if index + 1 >= len(sorted_keys):
            return None
        else:
            return grandparent.children[sorted_keys[index + 1]]