def pickleMethod(method):
    'support function for copy_reg to pickle method refs'
    if _PY3:
        return (unpickleMethod, (method.__name__,
                                 method.__self__,
                                 method.__self__.__class__))
    else:
        return (unpickleMethod, (method.im_func.__name__,
                                 method.im_self,
                                 method.im_class))
support function for copy_reg to pickle method refs
stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/styles.py