def make_tm_request(method, uri, **kwargs):
headers = kwargs.get("<STR_LIT>", {})<EOL>user_agent = "<STR_LIT>" % (<EOL>__version__,<EOL>platform.python_version()<EOL>)<EOL>headers["<STR_LIT>"] = user_agent<EOL>headers["<STR_LIT>"] = "<STR_LIT:utf-8>"<EOL>if "<STR_LIT>" not in headers:<EOL><INDENT>headers["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if (method == "<STR_LIT:POST>" or method == "<STR_LIT>") and "<STR_LIT:Content-Type>" not in headers:<EOL><INDENT>headers["<STR_LIT:Content-Type>"] = "<STR_LIT>"<EOL><DEDENT>kwargs["<STR_LIT>"] = headers<EOL>if "<STR_LIT>" not in headers:<EOL><INDENT>headers["<STR_LIT>"] = "<STR_LIT:application/json>"<EOL><DEDENT>headers["<STR_LIT>"], headers["<STR_LIT>"] = kwargs["<STR_LIT>"]<EOL>response = make_request(method, uri, **kwargs)<EOL>if not response.ok:<EOL><INDENT>try:<EOL><INDENT>resp_body = json.loads(response.content)<EOL>message = resp_body["<STR_LIT:message>"]<EOL>errors = resp_body["<STR_LIT>"]<EOL><DEDENT>except:<EOL><INDENT>message = response.content<EOL>errors = None<EOL><DEDENT>raise TextmagicRestException(status=response.status, method=method, uri=response.url,<EOL>msg=message, errors=errors)<EOL><DEDENT>return response<EOL>
Make a request to TextMagic REST APIv2.

:param str method: "POST", "GET", "PUT" or "DELETE"
:param str uri:    URI to process request.
:return: :class:`Response`