def check_package_data_first(command):
 class DecoratedCommand(command, ):
  def run(self):
   check_package_data(self.package_data)
   command.run(self)
 return DecoratedCommand

def check_package_data_first ( command ) : class DecoratedCommand ( command , ) : def run ( self ) : check_package_data ( self . package_data ) command . run ( self ) return DecoratedCommand
decorator for checking package_data before running a given command probably only needs to wrap build_py .