remove duplicated code

Looks like when @dmyung  was making some caching changes, he accidentally duplicated some code. I didn't fix all of the issues in that file as some of other duplicated code isn't an exact copy, so I'm not which version is the correct one

still needs to be fixed:
https://github.com/dimagi/commcare-hq/blob/f40ffbc19ae4fa598a70388e705291c45e395e1f/corehq/apps/hqwebapp/templatetags/hq_shared_tags.py#L153 
https://github.com/dimagi/commcare-hq/blob/f40ffbc19ae4fa598a70388e705291c45e395e1f/corehq/apps/hqwebapp/templatetags/hq_shared_tags.py#L133