def add_ids_args(parser, required=True):
    """
    Helper function. Adds arguments for ids to various subcommands.
    :param parser: subcommand parser object
    :return: parser (enhanced with new arguments!)
    """
    ids = parser.add_mutually_exclusive_group(required=required)
    ids.add_argument(
        "--ids",
        "-i",
        type=int,
        nargs="*",
        help="Specify specific job ids of interest",
        action="store",
    )
    ids.add_argument(
        "--range",
        "-r",
        type=int,
        nargs=2,
        help="Specify a range of job ids of interest. NB: this"
        "script INCLUDES the last id in the range.",
        action="store",
    )
    return parser