def token_from_blob(blob):
 parts = _split_token_parts(blob)
 if (parts[0] == '1c'):
  return ClientLoginToken(parts[1])
 elif (parts[0] == '1a'):
  return AuthSubToken(parts[1], parts[2:])
 elif (parts[0] == '1s'):
  return SecureAuthSubToken(parts[1], parts[2], parts[3:])
 elif (parts[0] == '1rtl'):
  return TwoLeggedOAuthRsaToken(parts[1], parts[2], parts[3])
 elif (parts[0] == '1htl'):
  return TwoLeggedOAuthHmacToken(parts[1], parts[2], parts[3])
 elif (parts[0] == '1r'):
  auth_state = int(parts[5])
  return OAuthRsaToken(parts[1], parts[2], parts[3], parts[4], auth_state, parts[6], parts[7])
 elif (parts[0] == '1h'):
  auth_state = int(parts[5])
  return OAuthHmacToken(parts[1], parts[2], parts[3], parts[4], auth_state, parts[6], parts[7])
 elif (parts[0] == '2o'):
  return OAuth2Token(parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])
 else:
  raise UnsupportedTokenType(('Unable to deserialize token with type marker of %s' % parts[0]))

def token_from_blob ( blob ) : parts = _split_token_parts ( blob ) if ( parts [ 0 ] == '1c' ) : return ClientLoginToken ( parts [ 1 ] ) elif ( parts [ 0 ] == '1a' ) : return AuthSubToken ( parts [ 1 ] , parts [ 2 : ] ) elif ( parts [ 0 ] == '1s' ) : return SecureAuthSubToken ( parts [ 1 ] , parts [ 2 ] , parts [ 3 : ] ) elif ( parts [ 0 ] == '1rtl' ) : return TwoLeggedOAuthRsaToken ( parts [ 1 ] , parts [ 2 ] , parts [ 3 ] ) elif ( parts [ 0 ] == '1htl' ) : return TwoLeggedOAuthHmacToken ( parts [ 1 ] , parts [ 2 ] , parts [ 3 ] ) elif ( parts [ 0 ] == '1r' ) : auth_state = int ( parts [ 5 ] ) return OAuthRsaToken ( parts [ 1 ] , parts [ 2 ] , parts [ 3 ] , parts [ 4 ] , auth_state , parts [ 6 ] , parts [ 7 ] ) elif ( parts [ 0 ] == '1h' ) : auth_state = int ( parts [ 5 ] ) return OAuthHmacToken ( parts [ 1 ] , parts [ 2 ] , parts [ 3 ] , parts [ 4 ] , auth_state , parts [ 6 ] , parts [ 7 ] ) elif ( parts [ 0 ] == '2o' ) : return OAuth2Token ( parts [ 1 ] , parts [ 2 ] , parts [ 3 ] , parts [ 4 ] , parts [ 5 ] , parts [ 6 ] , parts [ 7 ] , parts [ 8 ] ) else : raise UnsupportedTokenType ( ( 'Unable to deserialize token with type marker of %s' % parts [ 0 ] ) )
deserializes a token string from the datastore back into a token object .