
import sys


def convert(in_file, out_file, tag):
    """Copy `in_file` to `out_file` and append the string `tag`.
    """
    with open(out_file, 'wb') as out_f:
        with open(in_file, 'rb') as in_f:
            out_f.write(in_f.read())
        out_f.write(tag)


if __name__ == '__main__':
    convert(sys.argv[1], sys.argv[2], sys.argv[3])


import sys


def convert(in_file, out_file, tag):
    """Copy `in_file` to `out_file` and append the string `tag`.
    """
    # On Python 3, encode the tag argument as bytes.
    if not isinstance(tag, bytes):
        tag = tag.encode('utf8')

    with open(out_file, 'wb') as out_f:
        with open(in_file, 'rb') as in_f:
            out_f.write(in_f.read())
        out_f.write(tag)


if __name__ == '__main__':
    convert(sys.argv[1], sys.argv[2], sys.argv[3])

Convert stub: Python 3 compatibility
Convert stub: Python 3 compatibility

Important for systems where `python` is 3.x, like Arch, even when beets itself
is running on Python 2.

  
  import sys
  
  
  def convert(in_file, out_file, tag):
      """Copy `in_file` to `out_file` and append the string `tag`.
      """
+     # On Python 3, encode the tag argument as bytes.
+     if not isinstance(tag, bytes):
+         tag = tag.encode('utf8')
+ 
      with open(out_file, 'wb') as out_f:
          with open(in_file, 'rb') as in_f:
              out_f.write(in_f.read())
          out_f.write(tag)
  
  
  if __name__ == '__main__':
      convert(sys.argv[1], sys.argv[2], sys.argv[3])
  
Convert stub: Python 3 compatibility
## Code Before:

import sys


def convert(in_file, out_file, tag):
    """Copy `in_file` to `out_file` and append the string `tag`.
    """
    with open(out_file, 'wb') as out_f:
        with open(in_file, 'rb') as in_f:
            out_f.write(in_f.read())
        out_f.write(tag)


if __name__ == '__main__':
    convert(sys.argv[1], sys.argv[2], sys.argv[3])

## Instruction:
Convert stub: Python 3 compatibility
## Code After:

import sys


def convert(in_file, out_file, tag):
    """Copy `in_file` to `out_file` and append the string `tag`.
    """
    # On Python 3, encode the tag argument as bytes.
    if not isinstance(tag, bytes):
        tag = tag.encode('utf8')

    with open(out_file, 'wb') as out_f:
        with open(in_file, 'rb') as in_f:
            out_f.write(in_f.read())
        out_f.write(tag)


if __name__ == '__main__':
    convert(sys.argv[1], sys.argv[2], sys.argv[3])
