'Evaluate a source string or node, using ``filename`` when
displaying errors.'

def evaluate(self, node, filename=None):

    if isinstance(node, string_types):
        self.source = node
        kwargs = {'mode': 'eval'}
        if filename:
            kwargs['filename'] = filename
        try:
            node = ast.parse(node, **kwargs)
        except SyntaxError as e:
            s = self.get_fragment(e.offset)
            raise SyntaxError(('syntax    error    %s' % s))
    node_type = node.__class__.__name__.lower()
    handler = self.get_handler(node_type)
    if (handler is None):
        if (self.source is None):
            s = '(source    not    available)'
        else:
            s = self.get_fragment(node.col_offset)
        raise SyntaxError(("don't    know    how    to    evaluate    %r    %s" % (node_type, s)))
    return handler(node)
