def _replace_and_pad(fmt, marker, replacement):
    """
    Args:
        fmt (str | unicode): Format to tweak
        marker (str | unicode): Marker to replace
        replacement (str | unicode): What to replace marker with

    Returns:
        (str): Resulting format, with marker replaced
    """
    if marker not in fmt:
        return fmt
    if replacement:
        return fmt.replace(marker, replacement)
    # Remove mention of 'marker' in 'fmt', including leading space (if present)
    fmt = fmt.replace("%s " % marker, marker)
    return fmt.replace(marker, "")
Args:
        fmt (str | unicode): Format to tweak
        marker (str | unicode): Marker to replace
        replacement (str | unicode): What to replace marker with

    Returns:
        (str): Resulting format, with marker replaced