# Path: ice/logs.py
# STREAM_STRING_FORMAT = '%(leveltag)s%(message)s'
# FILE_STRING_FORMAT = '%(asctime)s [%(levelname)s][%(filename)s][%(funcName)s:%(lineno)s]: %(message)s'
# def is_test_stack_frame(frame):
# def is_running_in_test():
#   def _tag_for_level(self, levelno):
#   def filter(self, record):
# def create_stream_handler(level):
# def create_file_handler(level):
# def create_logger():
# class IceLevelTagFilter(logging.Formatter):


import sys
import os
import urllib
import urllib2
import grid_image_provider
from ice.logs import logger
    return "http://consolegrid.com/api/top_picture"

  @staticmethod
  def is_enabled():
    # TODO: Return True/False based on the current network status
    return True

  def consolegrid_top_picture_url(self, rom):
    host = self.api_url()
    quoted_name = urllib.quote(rom.name)
    return "%s?console=%s&game=%s" % (host, rom.console.shortname, quoted_name)

  def find_url_for_rom(self, rom):
    """
    Determines a suitable grid image for a given ROM by hitting
    ConsoleGrid.com
    """
    try:
      response = urllib2.urlopen(self.consolegrid_top_picture_url(rom))
      if response.getcode() == 204:
        name = rom.name
        console = rom.console.fullname
        logger.debug(
          "ConsoleGrid has no game called `%s` for %s" % (name, console)
        )
      else:
        return response.read()
    except urllib2.URLError as error:
      # Connection was refused. ConsoleGrid may be down, or something bad
      # may have happened

# Path: ice/logs.py
# STREAM_STRING_FORMAT = '%(leveltag)s%(message)s'
# FILE_STRING_FORMAT = '%(asctime)s [%(levelname)s][%(filename)s][%(funcName)s:%(lineno)s]: %(message)s'
# def is_test_stack_frame(frame):
# def is_running_in_test():
#   def _tag_for_level(self, levelno):
#   def filter(self, record):
# def create_stream_handler(level):
# def create_file_handler(level):
# def create_logger():
# class IceLevelTagFilter(logging.Formatter):


# Path: ice/gridproviders/consolegrid_provider.py
import sys
import os
import urllib
import urllib2
import grid_image_provider
from ice.logs import logger

    return "http://consolegrid.com/api/top_picture"

  @staticmethod
  def is_enabled():
    # TODO: Return True/False based on the current network status
    return True

  def consolegrid_top_picture_url(self, rom):
    host = self.api_url()
    quoted_name = urllib.quote(rom.name)
    return "%s?console=%s&game=%s" % (host, rom.console.shortname, quoted_name)

  def find_url_for_rom(self, rom):
    """
    Determines a suitable grid image for a given ROM by hitting
    ConsoleGrid.com
    """
    try:
      response = urllib2.urlopen(self.consolegrid_top_picture_url(rom))
      if response.getcode() == 204:
        name = rom.name
        console = rom.console.fullname
        logger.debug(
          "ConsoleGrid has no game called `%s` for %s" % (name, console)
        )
      else:
        return response.read()
    except urllib2.URLError as error:
      # Connection was refused. ConsoleGrid may be down, or something bad
      # may have happened

      logger.debug(