code: def _common_scan(self, values_function, cursor='0', match=None, count=10, key=None):
          
          if count is None:
              count = 10
          cursor = int(cursor)
          count = int(count)
          if not count:
              raise ValueError('if specified, count must be > 0: %s' % count)
  
          values = values_function()
          if cursor + count >= len(values):
              # we reached the end, back to zero
              result_cursor = 0
          else:
              result_cursor = cursor + count
  
          values = values[cursor:cursor+count]
  
          if match is not None:
              regex = re.compile(b'^' + re.escape(self._encode(match)).replace(b'\\*', b'.*') + b'$')
              if not key:
                  key = lambda v: v
              values = [v for v in values if regex.match(key(v))]
  
          return [result_cursor, values]
docs: Common scanning skeleton.
  
          :param key: optional function used to identify what 'match' is applied to