<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_message(msg):
 """ Formatting function for assert messages. Fetches the filename, function and line number of the code causing the fail and formats it into a three-line error message. Stack inspection is used to get the information. Originally done by BLE-team for their testcases. :param msg: Message to be printed along with the information. :return: Formatted message as string. """

    callerframerecord = inspect.stack()[2]
    frame = callerframerecord[0]
    info = inspect.getframeinfo(frame)
    _, filename = os.path.split(info.filename)
    caller_site = "In file {!s}, in function {!s}, at line {:d}".format(filename,
                                                                        info.function,
                                                                        info.lineno)
    return "{!s}\n{!s}\n{!s}".format(msg, caller_site, info.code_context)