def dedent(source, use_tabs=False):
if use_tabs:<EOL><INDENT>indent_char = '<STR_LIT:\t>'<EOL><DEDENT>else:<EOL><INDENT>indent_char = '<STR_LIT:U+0020>'<EOL><DEDENT>io_obj = io.StringIO(source)<EOL>out = "<STR_LIT>"<EOL>last_lineno = -<NUM_LIT:1><EOL>last_col = <NUM_LIT:0><EOL>prev_start_line = <NUM_LIT:0><EOL>indentation = "<STR_LIT>"<EOL>indentation_level = <NUM_LIT:0><EOL>for i, tok in enumerate(tokenize.generate_tokens(io_obj.readline)):<EOL><INDENT>token_type = tok[<NUM_LIT:0>]<EOL>token_string = tok[<NUM_LIT:1>]<EOL>start_line, start_col = tok[<NUM_LIT:2>]<EOL>end_line, end_col = tok[<NUM_LIT:3>]<EOL>if start_line > last_lineno:<EOL><INDENT>last_col = <NUM_LIT:0><EOL><DEDENT>if token_type == tokenize.INDENT:<EOL><INDENT>indentation_level += <NUM_LIT:1><EOL>continue<EOL><DEDENT>if token_type == tokenize.DEDENT:<EOL><INDENT>indentation_level -= <NUM_LIT:1><EOL>continue<EOL><DEDENT>indentation = indent_char * indentation_level<EOL>if start_line > prev_start_line:<EOL><INDENT>if token_string in ('<STR_LIT:U+002C>', '<STR_LIT:.>'):<EOL><INDENT>out += str(token_string)<EOL><DEDENT>else:<EOL><INDENT>out += indentation + str(token_string)<EOL><DEDENT><DEDENT>elif start_col > last_col:<EOL><INDENT>out += indent_char + str(token_string)<EOL><DEDENT>else:<EOL><INDENT>out += token_string<EOL><DEDENT>prev_start_line = start_line<EOL>last_col = end_col<EOL>last_lineno = end_line<EOL><DEDENT>return out<EOL>
Minimizes indentation to save precious bytes.  Optionally, *use_tabs*
may be specified if you want to use tabulators (\t) instead of spaces.

Example::

    def foo(bar):
        test = "This is a test"

Will become::

    def foo(bar):
     test = "This is a test"