'Writes data in JSON format to a specified file.'

def write_to_cache(self, data, filename):

    json_data = self.json_format_dict(data, self.args.pretty)
    cache = open(filename, 'w')
    cache.write(json_data)
    cache.close()
