code: def ElementFactory(href, smcresult=None, raise_exc=None):
      
      if smcresult is None:
          smcresult = SMCRequest(href=href).read()
      if smcresult.json:
          cache = ElementCache(smcresult.json, etag=smcresult.etag)
          typeof = lookup_class(cache.type)
          instance = typeof(
              name=cache.get('name'),
              href=href,
              type=cache.type)
          instance.data = cache
          return instance
      if raise_exc and smcresult.msg:
          raise raise_exc(smcresult.msg)
docs: Factory returns an object of type Element when only
      the href is provided.
      
      :param str href: string href to fetch
      :param SMCResult smcresult: optional SMCResult. If provided,
          the request fetch will be skipped
      :param Exception raise_exc: exception to raise if fetch
          failed