def METHOD_NAME(input_json, out_lef, bodyswitch, blockM, p, *, mode='routing'):
    exclude_layers = p.get_lef_exclude()
    with open(p.layerfile, "rt") as fp1:
        j1 = json.load(fp1)
    Scale_factor = j1["ScaleFactor"]
    m2pitch = p['M2']['Pitch']
    m3pitch = p['M3']['Pitch']
    with open(input_json, "rt") as fp:
        layout_d = json.load(fp)
    if mode == 'placement':
        output_file_name = out_lef + '.placement_lef'
    else:
        output_file_name = out_lef + '.lef'
    with (input_json.parents[0] / output_file_name).open("wt") as fp:
        lef_from_layout_d(layout_d, fp, out_lef, bodyswitch, blockM, exclude_layers=exclude_layers, Scale_factor=Scale_factor, m2pitch=m2pitch, m3pitch=m3pitch, mode=mode)