def create_sketch(sketch_name):
    arduino_info = st_base.get_arduino_info()
    sketchbook_dir = arduino_info.get_sketchbook_dir()
    sketchbook_path = sketchbook_dir.get_path()
    sketch_path = os.path.join(sketchbook_path, sketch_name)

    index = 0
    org_name = sketch_name
    while os.path.exists(sketch_path):
        sketch_name = '%s_%d' % (org_name, index)
        sketch_path = os.path.join(sketchbook_path, sketch_name)
        index += 1
    os.makedirs(sketch_path)

    settings = st_base.get_settings()
    bare_gcc = settings.get('bare_gcc', False)

    if bare_gcc:
        ext = '.cpp'
    else:
        ext = '.ino'

    template_file_name = 'template' + ext
    preset_path = st_base.get_preset_path()
    template_file_path = os.path.join(preset_path, template_file_name)
    template_file = pyarduino.base.abs_file.File(template_file_path)
    src_code = template_file.read()

    src_file_name = sketch_name + ext
    src_file_path = os.path.join(sketch_path, src_file_name)
    src_file = pyarduino.base.abs_file.File(src_file_path)

    src_code = src_code.replace('${src_file_name}', src_file_name)
    src_file.write(src_code)

    arduino_info.reload()
    arduino_info.update()
    st_menu.create_sketchbook_menu(arduino_info)
    return sketch_path
dataset/ETHPy150Open Robot-Will/Stino/stino/main.py/create_sketch/original