def convert_tokens(tokens):
 if (tokens == 'None'):
  return None
 elif (isinstance(tokens, basestring) or (not isinstance(tokens, collections.Iterable))):
  return tokens
 elif isinstance(tokens, dict):
  return {convert_tokens(k): convert_tokens(v) for (k, v) in tokens.items()}
 else:
  return [convert_tokens(v) for v in tokens]

def convert_tokens ( tokens ) : if ( tokens == 'None' ) : return None elif ( isinstance ( tokens , basestring ) or ( not isinstance ( tokens , collections . Iterable ) ) ) : return tokens elif isinstance ( tokens , dict ) : return { convert_tokens ( k ) : convert_tokens ( v ) for ( k , v ) in tokens . items ( ) } else : return [ convert_tokens ( v ) for v in tokens ]
this function is called on the token dictionary that is imported from a yaml file .