def get_occurrences(self, start, end, *, limit=None, query=None, order_by=None, batch=None):
if self.event_type != EventType.SeriesMaster:<EOL><INDENT>return []<EOL><DEDENT>url = self.build_url(<EOL>self._endpoints.get('<STR_LIT>').format(id=self.object_id))<EOL>if limit is None or limit > self.protocol.max_top_value:<EOL><INDENT>batch = self.protocol.max_top_value<EOL><DEDENT>params = {'<STR_LIT>': batch if batch else limit}<EOL>if order_by:<EOL><INDENT>params['<STR_LIT>'] = order_by<EOL><DEDENT>if query:<EOL><INDENT>if isinstance(query, str):<EOL><INDENT>params['<STR_LIT>'] = query<EOL><DEDENT>else:<EOL><INDENT>params.update(query.as_params())<EOL><DEDENT><DEDENT>if start.tzinfo is None:<EOL><INDENT>start = self.protocol.timezone.localize(start)  <EOL><DEDENT>if start.tzinfo != pytz.utc:<EOL><INDENT>start = start.astimezone(pytz.utc)  <EOL><DEDENT>if end.tzinfo is None:<EOL><INDENT>end = self.protocol.timezone.localize(end)  <EOL><DEDENT>if end.tzinfo != pytz.utc:<EOL><INDENT>end = end.astimezone(pytz.utc)  <EOL><DEDENT>params[self._cc('<STR_LIT>')] = start.isoformat()<EOL>params[self._cc('<STR_LIT>')] = end.isoformat()<EOL>response = self.con.get(url, params=params,<EOL>headers={'<STR_LIT>': '<STR_LIT>'})<EOL>if not response:<EOL><INDENT>return iter(())<EOL><DEDENT>data = response.json()<EOL>events = (self.__class__(parent=self, **{self._cloud_data_key: event})<EOL>for event in data.get('<STR_LIT:value>', []))<EOL>next_link = data.get(NEXT_LINK_KEYWORD, None)<EOL>if batch and next_link:<EOL><INDENT>return Pagination(parent=self, data=events,<EOL>constructor=self.__class__,<EOL>next_link=next_link, limit=limit)<EOL><DEDENT>else:<EOL><INDENT>return events<EOL><DEDENT>
Returns all the occurrences of a seriesMaster event for a specified time range.
:type start: datetime
:param start: the start of the time range
:type end: datetime
:param end: the end of the time range
:param int limit: ax no. of events to get. Over 999 uses batch.
:type query: Query or str
:param query: optional. extra filters or ordes to apply to this query
:type order_by: str
:param order_by: orders the result set based on this condition
:param int batch: batch size, retrieves items in
     batches allowing to retrieve more items than the limit.
:return: a list of events
:rtype: list[Event] or Pagination