def extract_json_content_rep(input_str):
    """
    Extracts JSON content from a string, removing surrounding ``` symbols
    and an optional 'json' tag.

    Args:
        input_str (str): The input string containing JSON content.

    Returns:
        str: Cleaned JSON string.
    """
    # Remove leading and trailing ``` symbols
    cleaned_str = re.sub(r"^```(?:json)?|```$", "", input_str.strip())
    return fix_trailing_comma(cleaned_str.strip())

    Extracts JSON content from a string, removing surrounding ``` symbols
    and an optional 'json' tag.

    Args:
        input_str (str): The input string containing JSON content.

    Returns:
        str: Cleaned JSON string.
    
PFPO/post_processors/openai_api_callback.py