docs: public static MetaClass metaClass (Object self, Closure closure){
          MetaClass emc = hasPerInstanceMetaClass(self);
          if (emc == null) {
              final ExpandoMetaClass metaClass = new ExpandoMetaClass(self.getClass(), false, true);
              metaClass.initialize();
              metaClass.define(closure);
              if (self instanceof GroovyObject) {
                  setMetaClass((GroovyObject)self, metaClass);
              } else {
                  setMetaClass(self, metaClass);
              }
              return metaClass;
          }
          else {
              if (emc instanceof ExpandoMetaClass) {
                  ((ExpandoMetaClass)emc).define(closure);
                  return emc;
              }
              else {
                  if (emc instanceof DelegatingMetaClass && ((DelegatingMetaClass)emc).getAdaptee() instanceof ExpandoMetaClass) {
                      ((ExpandoMetaClass)((DelegatingMetaClass)emc).getAdaptee()).define(closure);
                      return emc;
                  }
                  else {
                      throw new RuntimeException("Can't add methods to non-ExpandoMetaClass " + emc);
                  }
              }
          }
      }