<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def map_size(self, key):
 """ Get the number of items in the map. :param str key: The document ID of the map :return int: The number of items in the map :raise: :cb_exc:`NotFoundError` if the document does not exist. .. seealso:: :meth:`map_add` """

        # TODO: This should use get_count, but we need to check for compat
        # with server version (i.e. >= 4.6) first; otherwise it just
        # disconnects.

        rv = self.get(key)
        return len(rv.value)