'Return a dictionary of style properties applicable to Tag tag.'

def tag_css(self, tag, parent_css={}):

    def merge_parent_css(prop, pcss):
        inherited = ['text-align', 'float', 'white-space', 'color', 'line-height', 'vertical-align']
        temp = {}
        for key in pcss.keys():
            chk = key.lower()
            if (chk.startswith('font') or (chk in inherited)):
                temp[key] = pcss[key]
        prop.update(temp)
    (prop, pprop) = ({}, {})
    tagname = tag.name.lower()
    if parent_css:
        merge_parent_css(prop, parent_css)
    if tag.has_key('align'):
        al = tag['align'].lower()
        if (al in ('left', 'right', 'center', 'justify')):
            prop['text-align'] = al
    if self.css.has_key(tagname):
        prop.update(self.css[tagname])
    if self.pseudo_css.has_key(tagname):
        pprop.update(self.pseudo_css[tagname])
    if tag.has_key('class'):
        cls = tag['class'].lower()
        for cls in cls.split():
            for classname in [('.' + cls), ((tagname + '.') + cls)]:
                if self.css.has_key(classname):
                    prop.update(self.css[classname])
                if self.pseudo_css.has_key(classname):
                    pprop.update(self.pseudo_css[classname])
    if (tag.has_key('id') and self.css.has_key(tag['id'])):
        prop.update(self.css[tag['id']])
    if tag.has_key('style'):
        prop.update(self.parse_style_properties(tag['style']))
    return (prop, pprop)
