<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def makeReplacementField(formatSpec, altFormatSpec='', testValue=None):
 """ Prepends a colon and wraps the formatSpec in curly braces to yield a replacement field. The format specification is part of a replacement field, which can be used in new-style string formatting. See: https://docs.python.org/3/library/string.html#format-string-syntax https://docs.python.org/3/library/string.html#format-specification-mini-language If the formatSpec does not contain a a color or exclamation mark, a colon is prepended. If the formatSpec starts and end in quotes (single or double) only the quotes are removed, no curly braces or colon charactes are added. This allows users to define a format spec. :param formatSpec: e.g. '5.2f' will return '{:5.2f}' :param altFormatSpec: alternative that will be used if the formatSpec evaluates to False :param testValue: if not None, result.format(testValue) will be evaluated as a test. :return: string """

    check_is_a_string(formatSpec)
    check_is_a_string(altFormatSpec)
    fmt = altFormatSpec if not formatSpec else formatSpec

    if is_quoted(fmt):
        fmt = fmt[1:-1] # remove quotes
    else:
        if fmt and ':' not in fmt and '!' not in fmt:
            fmt = ':' + fmt
        fmt = '{' + fmt + '}'

    # Test resulting replacement field
    if testValue is not None:
        try:
            _dummy = fmt.format(testValue)
        except Exception:
            msg = ("Format specifier failed: replacement-field={!r}, test-value={!r}"
                   .format(fmt, testValue))
            logger.error(msg)
            raise ValueError(msg)

    logger.debug("Resulting replacement field: {!r}".format(fmt))
    return fmt