'Get the presence state for users.
Args:
target_user_ids (list)
as_event (bool): Whether to format it as a client event or not.
Returns:
list'

@defer.inlineCallbacks
def get_states(self, target_user_ids, as_event=False):

    updates = (yield self.current_state_for_users(target_user_ids))
    updates = updates.values()
    for user_id in (set(target_user_ids) - set((u.user_id for u in updates))):
        updates.append(UserPresenceState.default(user_id))
    now = self.clock.time_msec()
    if as_event:
        defer.returnValue([{'type': 'm.presence', 'content': format_user_presence_state(state, now)} for state in updates])
    else:
        defer.returnValue(updates)
