@Nullable public static List<PsiElement> searchForWrappingMethod(PsiElement start,boolean deep){
  PsiElement seeker=start;
  List<PsiElement> ret=new ArrayList<PsiElement>(2);
  while (seeker != null) {
    PyFunction func=PsiTreeUtil.getParentOfType(seeker,PyFunction.class,true,PyClass.class);
    if (func != null) {
      PyClass cls=func.getContainingClass();
      if (cls != null) {
        ret.add(func);
        ret.add(cls);
        return ret;
      }
 else       if (deep) {
        ret.add(func);
        seeker=func;
      }
 else {
        return null;
      }
    }
 else {
      return null;
    }
  }
  return null;
}

@ Nullable public static List < PsiElement > searchForWrappingMethod ( PsiElement start , boolean deep ) { PsiElement seeker = start ; List < PsiElement > ret = new ArrayList < PsiElement > ( 2 ) ; while ( seeker != null ) { PyFunction func = PsiTreeUtil . getParentOfType ( seeker , PyFunction . class , true , PyClass . class ) ; if ( func != null ) { PyClass cls = func . getContainingClass ( ) ; if ( cls != null ) { ret . add ( func ) ; ret . add ( cls ) ; return ret ; } else if ( deep ) { ret . add ( func ) ; seeker = func ; } else { return null ; } } else { return null ; } } return null ; }
searhes for a method wrapping given element .
