def comments_by_task(taskphid):
    #get the comment transactions by task
    coms =  phabdb.comment_transactions_by_task_phid(taskphid)
    final_comments = {}
    if not coms:
        return {}
    for i, c in enumerate(coms):
        comdetail = {}
        vlog('looking for email by user phid: %s' % (c[2],))
        comdetail['xuserphid'] = c[2]
        comdetail['xuseremail'] = phabdb.email_by_userphid(c[2])
        #for a comment transaction get all records (edits, etc)
        content = phabdb.comment_by_transaction(c[1])
        if len(content) > 1:
            iter = 0
            comver = 0
            while 1:
                if iter == len(content):
                    break
                for edit in content:
                    if edit[6] > comver:
                        comver = edit[6]
                        comdetail['text'] = edit[7]
                        comdetail['created'] = edit[10]
                        comdetail['last_edit'] = edit[11]
                iter += 1
        else:
            fcomment = phabdb.comment_by_transaction(c[1])[0]
            comdetail['text'] = fcomment[7]
            comdetail['created'] = fcomment[10]
            comdetail['last_edit'] = fcomment[11]

        final_comments[i] = comdetail

    return final_comments
exit()
print phabdb.set_tasks_blocked('PHID-TASK-llxzmfbbcc4adujigg4w', 'PHID-TASK-cjibddnd5lsa5n5hdsyx')

#print phabdb.get_blocking_tasks('PHID-TASK-llxzmfbbcc4adujigg4w')
#print phabdb.phid_by_custom_field('fl563')
print 'email', phabdb.email_by_userphid('PHID-USER-nnipdbdictreyx7qhaii')

#get the comment transactions by task
coms =  phabdb.comment_transactions_by_task_phid('PHID-TASK-3eivod3do3vzdviblbfr')

final_comments = {}
for i, c in enumerate(coms):
    comdetail = {}
    comdetail['userphid'] = c[3]
    #for a comment transaction get all records (edits, etc)
    content = phabdb.comment_by_transaction(c[1])
    if len(content) > 1:
        iter = 0
        while 1:
            if iter == len(content):
                break
            comver = 0
            for edit in content:
                if edit[6] > comver:
                    comver = edit[6]
                    comdetail['text'] = edit[7]
                    comdetail['created'] = edit[10]
                    comdetail['last_edit'] = edit[11]
            iter += 1
    else:
        fcomment = phabdb.comment_by_transaction(c[1])[0]