'Favorites tweets that match a phrase (hashtag, word, etc.).'

def auto_fav(self, phrase, count=100, result_type='recent'):

    result = self.search_tweets(phrase, count, result_type)
    for tweet in result['statuses']:
        try:
            if (tweet['user']['screen_name'] == self.BOT_CONFIG['TWITTER_HANDLE']):
                continue
            self.wait_on_action()
            result = self.TWITTER_CONNECTION.favorites.create(_id=tweet['id'])
            print(('Favorited:    %s' % result['text'].encode('utf-8')), file=sys.stdout)
        except TwitterHTTPError as api_error:
            if ('rate    limit' in str(api_error).lower()):
                print('You    have    been    rate    limited.    Wait    a    while    before    running    the    bot    again.', file=sys.stderr)
                return
            if ('you    have    already    favorited    this    status' not in str(api_error).lower()):
                print(('Error:    %s' % str(api_error)), file=sys.stderr)
