Generic POST query method

def PKCS_POST_query(self, req_hook, req_args):
        ''' Generic POST query method '''
        # HTTP POST queries require keyManagerTokens and sessionTokens
        headers = {'Content-Type': 'application/json',
                   'sessionToken': self.__session__,
                   'keyManagerToken': self.__keymngr__}

        # HTTP POST query to keymanager authenticate API
        try:
            if req_args is None:
                response = requests.post(self.__url__ + req_hook,
                                         headers=headers,
                                         cert=(self.__crt__, self.__key__),
                                         verify=True)
            else:
                response = requests.post(self.__url__ + req_hook,
                                         headers=headers,
                                         data=req_args,
                                         cert=(self.__crt__, self.__key__),
                                         verify=True)
        except requests.exceptions.RequestException as err:
            self.logger.error(err)
            return '500', 'Internal Error in PKCS_RESTful.POST_query()'
        # return the token
        self.logger.debug('%s: %s' % (response.status_code, response.text))
        return response.status_code, response.text