#NEWLINE# def adb_get_device( ) : #NEWLINE# #INDENT# '\n    Returns the serial number of a connected android device.\n\n    If there are more than one device connected to the machine, or it could not\n    find any device connected, :class:`wlauto.exceptions.ConfigError` is raised.\n    ' #NEWLINE# _check_env ( ) #NEWLINE# output = adb_command ( '0' , 'devices' ) . splitlines ( ) #NEWLINE# output_length = len ( output ) #NEWLINE# if ( output == 3 ) : #NEWLINE# #INDENT# return output [ 1 ] . split ( '\t' ) [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( output_length > 3 ) : #NEWLINE# #INDENT# raise ConfigError ( 'Number of discovered devices is {}, it should be 1' . format ( ( output_length - 2 ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ConfigError ( 'No device is connected and available' )