top10 = self.retweets.groupby("text")["text"].agg(["count"]).sort('count',ascending=0).head(10)
                
                print '-----------------------------------------------'
                print '-----------------------------------------------'
                print '-----------------------------------------------'
                print '-----------------------------------------------'
                print top10
                
            return True
        except Exception as e:
            print "Error: " + str(e)

    def on_error(self, status):
        print status

# main function call
if __name__ == '__main__':
    
    #This handles Twitter authetification and the connection to Twitter Streaming API
    myListener = twitterListener(15)
    
    auth = OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    stream = Stream(auth, myListener)
    stream.url = '/1.1/statuses/sample.json'
    stream.host = 'stream.twitter.com'
    stream.session.headers['Content-type'] = "application/x-www-form-urlencoded"
    stream.session.params = {'delimited': 'length'}
    stream._start(False)