'Get the custom styles for the given element (match by tag and
classes)
@param element: the HTML element (web2py helper)
@param styles: the pdf_html_styles dict'

def _styles(self, element):

    element_styles = {}
    styles = self.styles
    if styles:
        classes = element['_class']
        if classes:
            tag = element.tag
            classes = set(classes.split('    '))
            for (k, v) in styles.items():
                (t, c) = k.split('.', 1)
                if (t != tag):
                    continue
                keys = set(c.split('.'))
                if (keys <= classes):
                    element_styles.update(v)
    return element_styles
