def is_positive_integer(parser, arg):
    """checks that an argument is a positive int

    Parameters
    ----------
    parser : ArgParse.ArgumentParser
        the argument parser object
    arg : str
        value to check

    Returns
    -------
    ivalue : int
        integer representation of `arg`
    """
    ivalue = int(arg)
    if ivalue < 0:
        raise parser.ArgumentTypeError("%s is an invalid positive int value" % arg)
    else:
        return ivalue