def getProgramArgumentParser():
    """Return argparse object containing program arguments."""

    argParser = argparse.ArgumentParser(description=usage())

    # Mandatory parameters (though not set as required=True or can not use -V on own).
    mandatoryGrp = argParser.add_argument_group('mandatory arguments', 'These arguments must be supplied.')
    mandatoryGrp.add_argument('-b', '--body', action='store', dest='body', type=str,
        help='Body of email.  All lines from file used if file path provided.')
    mandatoryGrp.add_argument('-f', '--from', action='store', dest='frm', type=str,
        help='Who the email is from.  Only first line of file used if file path provided.')
    mandatoryGrp.add_argument('-m', '--machine', action='store', dest='smtphost', type=str,
        help='The name of SMTP host used to send the email.  Only first line of file used if file path provided.')
    mandatoryGrp.add_argument('-s', '--subject', action='store', dest='subject', type=str,
        help='The subject of the email.  Only first line of file used if file path provided.')
    mandatoryGrp.add_argument('-t', '--to', action='store', dest='to', type=str,
        help='Who the email is to be sent to.  One email address per line if file path provided.')

    # Optional parameters.
    optionalGrp = argParser.add_argument_group('extra optional arguments', 'These arguments are not mandatory.')
    optionalGrp.add_argument('-c', '--cc', action='store', dest='cc', type=str,
        help='Who the email is to be Carbon Copied (CC) to.  One email address per line if file path provided.')
    # TODO: FUNC_BCC
    #optionalGrp.add_argument('-B', '--bcc', action='store', dest='bcc', type=str,
    #    help='Who the email is to be Blind Carbon Copied (BCC) to.  One email address per line if file path provided.')
    optionalGrp.add_argument('-d', '--debug', action='store_true', dest='debug',
        help='Increase verbosity to help debugging.')
    optionalGrp.add_argument('-D', '--duration', action='store_true', dest='duration',
        help='Print to standard output the programs execution duration.')
    optionalGrp.add_argument('-V', '--version', action='store_true', dest='version',
        help='Print the version number to the standard output.  This version number should be included in all bug reports.')

    return argParser
Return argparse object containing program arguments.
recipes/Python/576807_Send_Email/recipe-576807.py