code: def generate_take(out_f, steps, line_prefix):
      
      out_f.write(
          '{0}constexpr inline int take(int n_)\n'
          '{0}{{\n'
          '{0}  return {1} 0 {2};\n'
          '{0}}}\n'
          '\n'.format(
              line_prefix,
              ''.join('n_ >= {0} ? {0} : ('.format(s) for s in steps),
              ')' * len(steps)
          )
      )
docs: Generate the take function