def main(args=None, vc=None, cwd=None, apply_config=False):
    """PEP8 clean only the parts of the files touched since the last commit, a
    previous commit or branch."""
    import signal

    try:  # pragma: no cover
        # Exit on broken pipe.
        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
    except AttributeError:  # pragma: no cover
        # SIGPIPE is not available on Windows.
        pass

    try:
        if args is None:
            args = []

        try:
            # Note: argparse on py 2.6 you can't pass a set
            # TODO neater solution for this!
            args_set = set(args)
        except TypeError:
            args_set = args  # args is a Namespace
        if '--version' in args_set or getattr(args_set, 'version', 0):
            print(version)
            return 0
        if '--list-fixes' in args_set or getattr(args_set, 'list_fixes', 0):
            from autopep8 import supported_fixes
            for code, description in sorted(supported_fixes()):
                print('{code} - {description}'.format(
                    code=code, description=description))
            return 0

        try:
            try:
                args = parse_args(args, apply_config=apply_config)
            except TypeError:
                pass  # args is already a Namespace (testing)
            if args.from_diff:  # pragma: no cover
                r = Radius.from_diff(args.from_diff.read(),
                                     options=args, cwd=cwd)
            else:
                r = Radius(rev=args.rev, options=args, vc=vc, cwd=cwd)
        except NotImplementedError as e:  # pragma: no cover
            print(e)
            return 1
        except CalledProcessError as c:  # pragma: no cover
            # cut off usage and exit
            output = c.output.splitlines()[0]
            print(output)
            return c.returncode

        any_changes = r.fix()
        if any_changes and args.error_status:
            return 1
        return 0

    except KeyboardInterrupt:  # pragma: no cover
        return 1
PEP8 clean only the parts of the files touched since the last commit, a
    previous commit or branch.