Python Range Function Implementation