class_docstr: Implements a conditional property using the descriptor protocol.
  
  Using this class to create a decorator will raise an ``AttributeError``
  if check(self) returns a falsey value. Note that if check raises an error
  this will also result in hasattr returning false.
  
  See https://docs.python.org/3/howto/descriptor.html for an explanation of
  descriptors.
class_docstr_tok: ["Implements","a","conditional","property","using","the","descriptor","protocol",".","Using","this","class","to","create","a","decorator","will","raise","an","``","AttributeError","``","if","check","(","self",")","returns","a","falsey","value",".","Note","that","if","check","raises","an","error","this","will","also","result","in","hasattr","returning","false",".","See","https",":","\/\/docs.python.org\/3\/howto\/descriptor.html","for","an","explanation","of","descriptors","."]
code: def __get__(self, obj, owner=None):
      attr_err = AttributeError(
          f"This {repr(owner.__name__)} has no attribute {repr(self.attribute_name)}"
      )
      if obj is not None:
          # delegate only on instances, not the classes.
          # this is to allow access to the docstrings.
          if not self.check(obj):
              raise attr_err
          out = MethodType(self.fn, obj)
  
      else:
          # This makes it possible to use the decorated method as an unbound method,
          # for instance when monkeypatching.
          @wraps(self.fn)
          def out(*args, **kwargs):
              if not self.check(args[0]):
                  raise attr_err
              return self.fn(*args, **kwargs)
  
      return out
  
imports: from functools import update_wrapper, wraps
  from types import MethodType
label_desc: Use image node_id 2 for calling the _AvailableIfDescriptor obj's underlying member method code with example usage: obj.__get__(obj, owner) and returns: out, self