class PreconditionError (TypeError):
    def __init__(self, callee, *args):
        TypeError.__init__(self, '{0.__name__}{1!r}'.format(callee, args))

from types import FunctionType, MethodType


class PreconditionError (TypeError):
    def __init__(self, callee, *args):
        if isinstance(callee, MethodType):
            name = '{0.im_class.__name__}.{0.im_func.__name__}'.format(callee)
        elif isinstance(callee, type) or isinstance(callee, FunctionType):
            name = callee.__name__

        TypeError.__init__(self, '{}{!r}'.format(name, args))

Implement prettier method names in PreconditionErrors as per spec; not yet full branch coverage.
Implement prettier method names in PreconditionErrors as per spec; not yet full branch coverage.

+ from types import FunctionType, MethodType
+ 
+ 
  class PreconditionError (TypeError):
      def __init__(self, callee, *args):
-         TypeError.__init__(self, '{0.__name__}{1!r}'.format(callee, args))
+         if isinstance(callee, MethodType):
+             name = '{0.im_class.__name__}.{0.im_func.__name__}'.format(callee)
+         elif isinstance(callee, type) or isinstance(callee, FunctionType):
+             name = callee.__name__
  
+         TypeError.__init__(self, '{}{!r}'.format(name, args))
+ 
Implement prettier method names in PreconditionErrors as per spec; not yet full branch coverage.
## Code Before:
class PreconditionError (TypeError):
    def __init__(self, callee, *args):
        TypeError.__init__(self, '{0.__name__}{1!r}'.format(callee, args))

## Instruction:
Implement prettier method names in PreconditionErrors as per spec; not yet full branch coverage.
## Code After:
from types import FunctionType, MethodType


class PreconditionError (TypeError):
    def __init__(self, callee, *args):
        if isinstance(callee, MethodType):
            name = '{0.im_class.__name__}.{0.im_func.__name__}'.format(callee)
        elif isinstance(callee, type) or isinstance(callee, FunctionType):
            name = callee.__name__

        TypeError.__init__(self, '{}{!r}'.format(name, args))
