def test(theseargs):
    
    parser = argparse.ArgumentParser(description='Get ofgem certificates for a given month & year')
    parser.add_argument('--month', type=int, default=1, action='store', help='Month')
    parser.add_argument('--year', type=int, default=2012, action='store', help='Year')
    parser.add_argument('--accreditation', action='store', help='Accreditation number to search for')
    parser.add_argument('--scheme', action='store', help='Scheme to search (defaults to RO and REGO)')

    args = parser.parse_args(args=theseargs)

    ocs = CertificateSearch()

    crit = "Searching Ofgem Certificates: "
    crits = []
    if args.month:
        ocs.set_month(args.month)
        crits.append('month %s' % args.month)
    if args.year:
        ocs.set_year(args.year)
        crits.append('year %s' % args.year)
    if args.scheme:
        ocs.set_scheme(args.scheme)
        crits.append('scheme %s' % args.scheme)

    if args.accreditation:
        ocs['accreditation_no'] = args.accreditation.upper()
        crits.append("accreditation number '%s'" % args.accreditation.upper())

    print(crit + ", ".join(crits))
    #ocs.dump_post_data()
    ocs.get_data()
    print("Total of %d records returned. Here are the first two:" % len(ocs))
    for s in ocs.certificates[0:1]:
        print(s.as_string())
    parser = argparse.ArgumentParser(description='Get ofgem certificates for a given month & year')
    parser.add_argument('--month', type=int, default=1, action='store', help='Month')
    parser.add_argument('--year', type=int, default=2012, action='store', help='Year')
    parser.add_argument('--accreditation', action='store', help='Accreditation number to search for')
    parser.add_argument('--scheme', action='store', help='Scheme to search (defaults to RO and REGO)')

    args = parser.parse_args()

    ocs = CertificateSearch()

    crit = "Searching Ofgem Certificates: "
    crits = []
    if args.month:
        ocs.set_month(args.month)
        crits.append('month %s' % args.month)
    if args.year:
        ocs.set_year(args.year)
        crits.append('year %s' % args.year)
    if args.scheme:
        ocs.set_scheme(args.scheme)
        crits.append('scheme %s' % args.scheme)

    if args.accreditation:
        ocs['accreditation_no'] = args.accreditation.upper()
        crits.append("accreditation number '%s'" % args.accreditation.upper())

    print crit + ", ".join(crits)
    ocs.dump_post_data()
    ocs.get_data()
    print "Total of %d records returned" % len(ocs)