code: def get_namespace(attribute, namespace_splitter=NAMESPACE_SPLITTER, root_only=False):
      
  
      attribute_tokens = attribute.split(namespace_splitter)
      if len(attribute_tokens) == 1:
          LOGGER.debug("> Attribute: '{0}', namespace: '{1}'.".format(attribute, Constants.null_object))
      else:
          namespace = foundations.common.get_first_item(attribute_tokens) if root_only else \
              namespace_splitter.join(attribute_tokens[0:-1])
          LOGGER.debug("> Attribute: '{0}', namespace: '{1}'.".format(attribute, namespace))
          return namespace
docs: Returns given attribute foundations.namespace.
  
      Usage::
  
          >>> get_namespace("grandParent|parent|child")
          u'grandParent|parent'
          >>> get_namespace("grandParent|parent|child", root_only=True)
          u'grandParent'
  
      :param attribute: Attribute.
      :type attribute: unicode
      :param namespace_splitter: Namespace splitter character.
      :type namespace_splitter: unicode
      :param root_only: Return only root foundations.namespace.
      :type root_only: bool
      :return: Attribute foundations.namespace.
      :rtype: unicode