for tok in tokenize.generate_tokens(io.BytesIO(source).readline):
    tok = Token(*tok)
print((tok.name, tok.val))
if tok.name == 'NAME':
    names.add(tok.val)
lastname = tok.val
if tok.name == 'OP' and tok.val == '=':
    not_dep.add(lastname)
print(names)
print(not_dep)
deps = dict.fromkeys(names - not_dep - kwset, 1)
print(deps)
Find dependencies in a python source/script