'Get a main sprite sprite for a pokemon.
Everything except version should be given as a keyword argument.
Either specify version as an ORM object, or give the version path as
a string (which is the only way to get \'red-green\'). Leave the default
for the latest version.
animated: get a GIF animation (currently Crystal & Emerald only)
back: get a backsprite instead of a front one
color: can be \'color\' (RGBY only) or \'gbc\' (Yellow only)
shiny: get a shiny sprite. In old versions, gives a normal sprite unless
`strict` is set
female: get a female sprite instead of male. For pokemon with no sexual
dimorphism, gets the common sprite unless `strict` is set.
frame: set to 2 to get the second frame of the animation
(Emerald, DPP, and HG/SS only)
If the sprite is not found, raise a ValueError.'

def sprite(self, version='black-white', animated=False, back=False, color=None, shiny=False, female=False, frame=None, strict=False):

    if isinstance(version, six.string_types):
        version_dir = version
        try:
            (generation, info) = self._pokemon_sprite_info[version_dir]
        except KeyError:
            raise ValueError('Version    directory    %s    not    found', version_dir)
    else:
        version_dir = version.identifier
        try:
            (generation, info) = self._pokemon_sprite_info[version_dir]
        except KeyError:
            version_group = version.version_group
            version_dir = '-'.join((v.identifier for v in version_group.versions))
            try:
                (generation, info) = self._pokemon_sprite_info[version_dir]
            except KeyError:
                raise ValueError('Version    directory    %s    not    found', version_dir)
    if (generation < self.introduced_in):
        raise ValueError(("Pokemon    %s    didn't    exist    in    %s" % (self.species_id, version_dir)))
    path_elements = ['main-sprites', version_dir]
    if animated:
        if ('animated' not in info):
            raise ValueError(('No    animated    sprites    for    %s' % version_dir))
        path_elements.append('animated')
        extension = '.gif'
    else:
        extension = '.png'
    if back:
        if (version_dir == 'emerald'):
            if strict:
                raise ValueError('Emerald    uses    R/S    backsprites')
            if animated:
                raise ValueError('No    animated    backsprites    for    Emerald')
            path_elements[1] = version_dir = 'ruby-sapphire'
        if ((version_dir == 'crystal') and animated):
            raise ValueError('No    animated    backsprites    for    Crystal')
        path_elements.append('back')
    if (color == 'gray'):
        if ('gray' not in info):
            raise ValueError(('No    grayscale    sprites    for    %s' % version_dir))
        path_elements.append('gray')
    elif (color == 'gbc'):
        if ('gbc' not in info):
            raise ValueError(('No    GBC    sprites    for    %s' % version_dir))
        path_elements.append('gbc')
    elif color:
        raise ValueError(('Unknown    color    scheme:    %s' % color))
    if shiny:
        if ('shiny' in info):
            path_elements.append('shiny')
        elif strict:
            raise ValueError(('No    shiny    sprites    for    %s' % version_dir))
    if female:
        female_sprite = self.has_gender_differences
        if ((self.species_id == '358') and back and (version_dir in ('platinum', 'heartgold-soulsilver'))):
            female_sprite = True
        female_sprite = (female_sprite and ('female' in info))
        if female_sprite:
            path_elements.append('female')
        elif strict:
            raise ValueError(('Pokemon    %s    has    no    gender    differences' % self.species_id))
    if ((not frame) or (frame == 1)):
        pass
    elif (frame == 2):
        if ('frame2' in info):
            path_elements.append(('frame%s' % frame))
        else:
            raise ValueError(('No    frame    2    for    %s' % version_dir))
    else:
        raise ValueError(('Bad    frame    %s' % frame))
    return self._get_file(path_elements, extension, strict=strict, surely_exists=(self.is_species and (version_dir == 'black-white') and (not back) and (not female)))
