<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def list_keypairs(self):

        '''
            a method to discover the list of key pairs on AWS

        :return: list of key pairs
        '''

        title = '%s.list_keypairs' % self.__class__.__name__

    # request subnet list from AWS
        self.iam.printer('Querying AWS region %s for key pairs.' % self.iam.region_name)
        keypair_list = []
        try:
            response = self.connection.describe_key_pairs()
        except:
            raise AWSConnectionError(title)
        response_list = []
        if 'KeyPairs' in response:
            response_list = response['KeyPairs']

    # construct list of keypairs from response
        for sub_dict in response_list:
            keypair_list.append(sub_dict['KeyName'])

    # report results and return list
        if keypair_list:
            print_out = 'Found key pair'
            if len(keypair_list) > 1:
                print_out += 's'
            from labpack.parsing.grammar import join_words
            print_out += ' %s.' % join_words(keypair_list)
            self.iam.printer(print_out)
        else:
            self.iam.printer('No key pairs found.')

        return keypair_list