'Return scope of name.
The scope of a name could be LOCAL, GLOBAL, FREE, or CELL.'

def check_name(self, name):

    if (name in self.globals):
        return SC_GLOBAL_EXPLICT
    else:
        if (name in self.cells):
            return SC_CELL
        if (name in self.defs):
            return SC_LOCAL
        if (self.nested and ((name in self.frees) or (name in self.uses))):
            return SC_FREE
        if self.nested:
            return SC_UNKNOWN
        return SC_GLOBAL_IMPLICIT
