public static boolean bindVariableToValueP(PatternVariable variable, Stella_Object value, boolean autocleanupP) {
    if ((value == null) ||
        (!Logic.argumentBoundP(value))) {
      if (((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
          (((QueryIterator)(Logic.$QUERYITERATOR$.get())).partialMatchStrategy != null)) &&
          ((QueryIterator)(Logic.$QUERYITERATOR$.get())).partialMatchStrategy.allowUnboundVariablesP()) {
        return (true);
      }
      { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

        try {
          Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
          Stella.STANDARD_WARNING.nativeStream.println("WARNING: Tried to bind " + variable + " to NULL value.  Potentially a PowerLoom bug");
          Logic.helpSignalPropositionError(Stella.STANDARD_WARNING, Logic.KWD_WARNING);

        } finally {
          Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
        }
      }
      return (false);
    }
    value = Logic.instantiateExternalBindings(value);
    if (autocleanupP) {
      { PatternRecord patternrecord = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord;
        int ubstackoffset = patternrecord.topUnbindingStackOffset;
        boolean successP = false;

        successP = PatternVariable.helpBindVariableToValueP(variable, value);
        if (!successP) {
          PatternRecord.unbindVariablesBeginningAt(patternrecord, ubstackoffset + 1);
        }
        return (successP);
      }
    }
    else {
      return (PatternVariable.helpBindVariableToValueP(variable, value));
    }
  }