def get_detailed_error_msg(ex_msg, ex_info):
    """Format error message to include details.

  Args:
    ex_msg: exception message.
    ex_info: exception info returned by sys.exc_info()
  Returns:
    a message string including error, file and line number.
  """
    _, exc_obj, exc_tb = ex_info
    fname = exc_tb.tb_frame.f_code.co_filename
    return 'error: {}, file: {}, loc: {}'.format(ex_msg, fname, exc_tb.
        tb_lineno)
