#NEWLINE# def get_shell_account( tid = None ) : #NEWLINE# #INDENT# "\n    Retrieves a team's shell account credentials.\n\n    Args:\n        tid: the team id. If no tid is specified, will try to get the active user's tid.\n    Returns:\n        The shell object. {username, password, hostname, port}\n    " #NEWLINE# db = api . common . get_conn ( ) #NEWLINE# tid = get_team ( tid ) [ 'tid' ] #NEWLINE# shell_account = db . ssh . find_one ( { #NEWLINE# #INDENT# 'tid' : tid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 0 , #NEWLINE# 'tid' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( shell_account is None ) : #NEWLINE# #INDENT# raise InternalException ( 'Team {} was not assigned a shell account.' . format ( tid ) ) #NEWLINE# #UNINDENT# return shell_account