<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def yosys_area_delay(library, abc_cmd=None, block=None):
 """ Synthesize with Yosys and return estimate of area and delay. :param library: stdcell library file to target in liberty format :param abc_cmd: string of commands for yosys to pass to abc for synthesis :param block: pyrtl block to analyze :return: a tuple of numbers: area, delay The area and delay are returned in units as defined by the stdcell library. In the standard vsc 130nm library, the area is in a number of "tracks", each of which is about 1.74 square um (see area estimation for more details) and the delay is in ps. http://www.vlsitechnology.org/html/vsc_description.html May raise `PyrtlError` if yosys is not configured correctly, and `PyrtlInternalError` if the call to yosys was not able successfully """


    if abc_cmd is None:
        abc_cmd = 'strash;scorr;ifraig;retime;dch,-f;map;print_stats;'
    else:
        # first, replace whitespace with commas as per yosys requirements
        re.sub(r"\s+", ',', abc_cmd)
        # then append with "print_stats" to generate the area and delay info
        abc_cmd = '%s;print_stats;' % abc_cmd

    def extract_area_delay_from_yosys_output(yosys_output):
        report_lines = [line for line in yosys_output.split('\n') if 'ABC: netlist' in line]
        area = re.match('.*area\s*=\s*([0-9\.]*)', report_lines[0]).group(1)
        delay = re.match('.*delay\s*=\s*([0-9\.]*)', report_lines[0]).group(1)
        return float(area), float(delay)

    yosys_arg_template = """-p
    read_verilog %s;
    synth -top toplevel;
    dfflibmap -liberty %s;
    abc -liberty %s -script +%s
    """

    temp_d, temp_path = tempfile.mkstemp(suffix='.v')
    try:
        # write the verilog to a temp
        with os.fdopen(temp_d, 'w') as f:
            OutputToVerilog(f, block=block)
        # call yosys on the temp, and grab the output
        yosys_arg = yosys_arg_template % (temp_path, library, library, abc_cmd)
        yosys_output = subprocess.check_output(['yosys', yosys_arg])
        area, delay = extract_area_delay_from_yosys_output(yosys_output)
    except (subprocess.CalledProcessError, ValueError) as e:
        print('Error with call to yosys...', file=sys.stderr)
        print('---------------------------------------------', file=sys.stderr)
        print(e.output, file=sys.stderr)
        print('---------------------------------------------', file=sys.stderr)
        raise PyrtlError('Yosys callfailed')
    except OSError as e:
        print('Error with call to yosys...', file=sys.stderr)
        raise PyrtlError('Call to yosys failed (not installed or on path?)')
    finally:
        os.remove(temp_path)
    return area, delay