code: def normalize_namespace(namespace):
      
      namespace = (DOT + DOT.join(RE_DOTS.split(namespace))).rstrip(DOT) + DOT
      return namespace
docs: Given a namespace (e.g. '.' or 'mynamespace'),
      returns it in normalized form. That is:
          - always prefixed with a dot
          - no trailing dots
          - any double dots are converted to single dot (..my..namespace => .my.namespace)
          - one or more dots (e.g. '.', '..', '...') are converted to '.' (Global namespace)