def attach_files(grouped_patches, soap_client, auth):
    all_okay = True

    for issue_id, patches in sorted(grouped_patches.items()):
        try:
            names = []
            datas = []
            for patch in patches:
                names.append(os.path.basename(patch))
                datas.append(SOAPpy.base64BinaryType(open(patch).read()))
            ret = soap_client.addAttachmentsToIssue(auth, issue_id, names, datas)
            if not ret:
                raise Exception("addAttachmentsToIssue returned false")
        except:
            all_okay = False
            traceback.print_exc()
        else:
            print "Successfully attached patch(es) to " + issue_id

    return all_okay