def num_of_shorts(domain=None): '''Count how many shorts we've got in the datastore Params domain - if not None count shorts for that domain, count all otherwise Return number of shorts: integer ''' query = UrlBox.all() if domain: query.filter(' domain = ', domain) return query.count()