#NEWLINE# def test_memcached( host , port ) : #NEWLINE# #INDENT# 'Connect to memcached.\n\n    :returns: True if test passed, False if test failed.\n\n    ' #NEWLINE# try : #NEWLINE# #INDENT# s = socket . socket ( ) #NEWLINE# s . connect ( ( exc , port ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# log . critical ( ( 'Failed to connect to memcached (%r): %s' % ( ( host , port ) , exc ) ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# s . close ( )