Define Range Function In Python For All Selected Lines