you define this function for each method. Better define it at the begin and use args or kwargs to pass vars.