def fix_code(source_code, line_ranges, options=None, verbose=<NUM_LIT:0>):
if options is None:<EOL><INDENT>from pep8radius.main import parse_args<EOL>options = parse_args()<EOL><DEDENT>if getattr(options, "<STR_LIT>", False):<EOL><INDENT>from yapf.yapflib.yapf_api import FormatCode<EOL>result = FormatCode(source_code, style_config=options.style, lines=line_ranges)<EOL>return result[<NUM_LIT:0>] if isinstance(result, tuple) else result<EOL><DEDENT>line_ranges = reversed(line_ranges)<EOL>partial = source_code<EOL>for start, end in line_ranges:<EOL><INDENT>partial = fix_line_range(partial, start, end, options)<EOL>_maybe_print('<STR_LIT:.>', end='<STR_LIT>', max_=<NUM_LIT:1>, verbose=verbose)<EOL><DEDENT>_maybe_print('<STR_LIT>', max_=<NUM_LIT:1>, verbose=verbose)<EOL>fixed = partial<EOL>return fixed<EOL>
Apply autopep8 over the line_ranges, returns the corrected code.

    Note: though this is not checked for line_ranges should not overlap.

    Example
    -------
    >>> code = "def f( x ):\\n  if  True:\\n    return 2*x"
    >>> print(fix_code(code, [(1, 1), (3, 3)]))
    def f(x):
      if  True:
          return 2 * x