'Returns the underlying scope.'

def get_parent_scope(self, include_flows=False):

    scope = self.parent
    while (scope is not None):
        if (include_flows and isinstance(scope, Flow)):
            return scope
        if scope.is_scope():
            break
        scope = scope.parent
    return scope
