#NEWLINE# def find_user( name , api_key = None ) : #NEWLINE# #INDENT# '\n    Find a user by name and return it.\n\n    :param name:        The user name.\n    :param api_key:     The Slack admin api key.\n    :return:            The user object.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt \'*\' slack.find_user name="ThomasHatch"\n\n        salt \'*\' slack.find_user name="ThomasHatch" api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15\n    ' #NEWLINE# if ( not api_key ) : #NEWLINE# #INDENT# api_key = _get_api_key ( ) #NEWLINE# #UNINDENT# ret = list_users ( api_key ) #NEWLINE# if ret [ 'res' ] : #NEWLINE# #INDENT# users = ret [ 'message' ] #NEWLINE# if users : #NEWLINE# #INDENT# for user in range ( 0 , len ( users ) ) : #NEWLINE# #INDENT# if ( users [ user ] [ 'name' ] == name ) : #NEWLINE# #INDENT# return users [ user ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return False