ENH make this a class method