#NEWLINE# def complete( tab , opts ) : #NEWLINE# #INDENT# '\n    get options that start with tab\n\n    :param tab: query string\n    :param opts: list that needs to be completed\n\n    :return: a string that start with tab\n    ' #NEWLINE# msg = '({0})' #NEWLINE# if tab : #NEWLINE# #INDENT# opts = [ m [ len ( tab ) : ] for m in opts if m . startswith ( tab ) ] #NEWLINE# #UNINDENT# if ( len ( opts ) == 1 ) : #NEWLINE# #INDENT# return opts [ 0 ] #NEWLINE# #UNINDENT# if ( not len ( opts ) ) : #NEWLINE# #INDENT# msg = '{0}' #NEWLINE# #UNINDENT# return msg . format ( '|' . join ( opts ) )