def METHOD_NAME(
    mediaPackage_content,
    element_name,
    type_name,
    mimetype,
    url_text,
    opencast_filename=None,
):
    """
    Create an XML element with the specified attributes.
    Args:
        mediaPackage_content: The media package content.
        element_name (str): The name of the XML element.
        type_name (str): The type of the XML element.
        mimetype (str): The mimetype of the XML element.
        url_text (str): The URL text of the XML element.
        opencast_filename : defaults to None.
    Returns:
        element : The created XML element.
    """
    element = mediaPackage_content.createElement(element_name)
    element.setAttributeNode(mediaPackage_content.createAttribute("id"))
    element.setAttributeNode(mediaPackage_content.createAttribute("type"))
    element.setAttribute("id", "%s" % uuid.uuid4())
    element.setAttribute("type", type_name)
    if element_name == "track":
        element.setAttributeNode(mediaPackage_content.createAttribute("filename"))
        element.setAttribute("filename", opencast_filename)
    mimetype_element = mediaPackage_content.createElement("mimetype")
    mimetype_element.appendChild(mediaPackage_content.createTextNode(mimetype))
    element.appendChild(mimetype_element)
    url = mediaPackage_content.createElement("url")
    url.appendChild(mediaPackage_content.createTextNode(url_text))
    element.appendChild(url)
    if element_name == "track":
        live = mediaPackage_content.createElement("live")
        live.appendChild(mediaPackage_content.createTextNode("false"))
        element.appendChild(live)
    return element