Function for parsing styles defined in the body of the document. 
        This only includes data inside of HTML <style> tags, a URL, or file to open.

def parse_inline_styles(self, data=None, import_type ='string'):
        """
        Function for parsing styles defined in the body of the document. 
        This only includes data inside of HTML <style> tags, a URL, or file to open.
        """
        if data is None:
            raise
        parser = cssutils.CSSParser()
        if import_type == 'string':
            #print "importing string with url=%s" % self.url_root
            sheet = parser.parseString(data,href=self.url_root)
        elif import_type == 'url':
          if data[:5].lower() == 'http:' or data[:6].lower() == 'https:':
            print "YES because it was: %s " % data[:5].lower()
            try:
                sheet = parser.parseUrl(data)
            except:
                sys.stderr.write("WARNING: Failed attempting to parse %s" % data)
                return
        elif import_type == 'file':
            sheet = parser.parseFile(data)
        else:
            raise

        hrefs = []
        for i in range(len(sheet.cssRules)):
            if sheet.cssRules[i].type == cssutils.css.CSSStyleRule.STYLE_RULE:
                selector = sheet.cssRules[i].selectorText
                #print "cssparser found  selector: %s" % selector
                selectors = selector.split(',')
                self.defined_classes.extend(selectors)

            elif ( self.follow_css_links == True and
                  sheet.cssRules[i].type == cssutils.css.CSSStyleRule.IMPORT_RULE ):
                href = sheet.cssRules[i].href
                sys.stderr.write("Added %s to the stylesheets to crawl" % href)
                
                if href[:5].lower() == 'http:' or href[:6].lower() == 'https:':
                    self.linked_sheets.append(href)
                else:
                    # We'll have to try to add in a url root here, if these are relative
                    # links.
                    self.linked_sheets.append(self.url_root+href)
                    self.parse_inline_styles(data=self.url_root+href, import_type='url')
            else:
                # We won't worry about the other rule types.
                pass