'Syncs the user\'s followers and follows locally so it isn\'t necessary
to repeatedly look them up via the Twitter API.
It is important to run this method at least daily so the bot is working
with a relatively up-to-date version of the user\'s follows.
Do not run this method too often, however, or it will quickly cause your
bot to get rate limited by the Twitter API.'

def sync_follows(self):

    followers_status = self.TWITTER_CONNECTION.followers.ids(screen_name=self.BOT_CONFIG['TWITTER_HANDLE'])
    followers = set(followers_status['ids'])
    next_cursor = followers_status['next_cursor']
    with open(self.BOT_CONFIG['FOLLOWERS_FILE'], 'w') as out_file:
        for follower in followers:
            out_file.write(('%s\n' % follower))
    while (next_cursor != 0):
        followers_status = self.TWITTER_CONNECTION.followers.ids(screen_name=self.BOT_CONFIG['TWITTER_HANDLE'], cursor=next_cursor)
        followers = set(followers_status['ids'])
        next_cursor = followers_status['next_cursor']
        with open(self.BOT_CONFIG['FOLLOWERS_FILE'], 'a') as out_file:
            for follower in followers:
                out_file.write(('%s\n' % follower))
    following_status = self.TWITTER_CONNECTION.friends.ids(screen_name=self.BOT_CONFIG['TWITTER_HANDLE'])
    following = set(following_status['ids'])
    next_cursor = following_status['next_cursor']
    with open(self.BOT_CONFIG['FOLLOWS_FILE'], 'w') as out_file:
        for follow in following:
            out_file.write(('%s\n' % follow))
    while (next_cursor != 0):
        following_status = self.TWITTER_CONNECTION.friends.ids(screen_name=self.BOT_CONFIG['TWITTER_HANDLE'], cursor=next_cursor)
        following = set(following_status['ids'])
        next_cursor = following_status['next_cursor']
        with open(self.BOT_CONFIG['FOLLOWS_FILE'], 'a') as out_file:
            for follow in following:
                out_file.write(('%s\n' % follow))
