<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check(cls, model, require_extra=False):
 """Check whether the provided model has this capability. By default, uses isinstance. If `require_extra`, also requires that an instance check be present in `model.extra_capability_checks`. """

        class_capable = isinstance(model, cls)

        f_name = model.extra_capability_checks.get(cls, None) \
            if model.extra_capability_checks is not None \
            else False

        if f_name:
            f = getattr(model, f_name)
            instance_capable = f()
        elif not require_extra:
            instance_capable = True
        else:
            instance_capable = False
        return class_capable and instance_capable