#NEWLINE# def bitcount( self , key , start = None , end = None ) : #NEWLINE# #INDENT# '\n        Count the number of set bits (population counting) in a string.\n\n        @param key: The Redis key to get bit count from.\n        @param start: Optional starting index for bytes to scan (inclusive)\n        @param end: Optional ending index for bytes to scan (inclusive).\n                    End index is required when start is given.\n        ' #NEWLINE# start_end = [ ] #NEWLINE# if ( start is not None ) : #NEWLINE# #INDENT# start_end . append ( start ) #NEWLINE# start_end . append ( end ) #NEWLINE# #UNINDENT# self . _send ( 'BITCOUNT' , key , * start_end ) #NEWLINE# return self . getResponse ( )