Checks the arguments and options.

    :param args: an object containing the options of the program.

    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

def checkArgs(args):
    """Checks the arguments and options.

    :param args: an object containing the options of the program.

    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

    """
    # Check the "before" file
    if not args.before.endswith(".bim"):
        msg = "%s: not a BIM file (extension must be .bim)" % args.before
        raise ProgramError(msg)
    elif not os.path.isfile(args.before):
        msg = "%s: no such file" % args.before
        raise ProgramError(msg)

    # Check the "after" file
    if not args.after.endswith(".bim"):
        msg = "%s: not a BIM file (extension must be .bim)" % args.after
        raise ProgramError(msg)
    elif not os.path.isfile(args.after):
        msg = "%s: no such file" % args.after
        raise ProgramError(msg)

    return True