smart code by python