def output_file(out):
    """Convert file path to writeable file object."""

    try:
        return open(out, 'w')
    except IOError as exc:
        print('Error opening output file at path: {}.\n\n{}'.format(out, exc))
        exit(1)