import math


def circleconvert(amount, currentformat, newformat):
    """
    Convert a circle measurement.
    
    :type amount: number
    :param amount: The number to convert.
    
    :type currentformat: string
    :param currentformat: The format of the provided value.
    
    :type newformat: string
    :param newformat: The intended format of the value.
    
    >>> circleconvert(45, "radius", "radius")
    45
    
    >>> circleconvert(45, "radius", "diameter")
    90
    
    >>> circleconvert(45, "radius", "circumference")
    282.7433388230814
    
    >>> circleconvert(45, "diameter", "diameter")
    45
    
    >>> circleconvert(45, "diameter", "radius")
    22.5
    
    >>> circleconvert(45, "diameter", "circumference")
    141.3716694115407
    
    >>> circleconvert(45, "circumference", "circumference")
    45
    
    >>> circleconvert(45, "circumference", "radius")
    7.16197243913529
    
    >>> circleconvert(45, "circumference", "diameter")
    14.32394487827058
    
    >>> circleconvert(45, "foo1", "foo2")
    Traceback (most recent call last):
        ...
    ValueError: Invalid old format provided.
    
    >>> circleconvert(45, "radius", "foo")
    Traceback (most recent call last):
        ...
    ValueError: Invalid new format provided.
    
    >>> circleconvert(45, "diameter", "foo")
    Traceback (most recent call last):
        ...
    ValueError: Invalid new format provided.
    
    >>> circleconvert(45, "circumference", "foo")
    Traceback (most recent call last):
        ...
    ValueError: Invalid new format provided.
    """

    # If the same format was provided
    if currentformat.lower() == newformat.lower():
        # Return the provided value
        return amount

    # If the lowercase version of the current format is 'radius'
    if currentformat.lower() == 'radius':
        # If the lowercase version of the new format is 'diameter'
        if newformat.lower() == 'diameter':
            # Return the converted value
            return amount * 2

        # If the lowercase version of the new format is 'circumference'
        elif newformat.lower() == 'circumference':
            # Return the converted value
            return amount * 2 * math.pi

        # Raise a warning
        raise ValueError("Invalid new format provided.")

    # If the lowercase version of the current format is 'diameter'
    elif currentformat.lower() == 'diameter':
        # If the lowercase version of the new format is 'radius'
        if newformat.lower() == 'radius':
            # Return the converted value
            return amount / 2

        # If the lowercase version of the new format is 'circumference'
        elif newformat.lower() == 'circumference':
            # Return the converted value
            return amount * math.pi

        # Raise a warning
        raise ValueError("Invalid new format provided.")

    # If the lowercase version of the current format is 'circumference'
    elif currentformat.lower() == 'circumference':
        # If the lowercase version of the new format is 'radius'
        if newformat.lower() == 'radius':
            # Return the converted value
            return amount / math.pi / 2

        # If the lowercase version of the new format is 'diameter'
        elif newformat.lower() == 'diameter':
            # Return the converted value
            return amount / math.pi

        # Raise a warning
        raise ValueError("Invalid new format provided.")

    # Raise a warning
    raise ValueError("Invalid old format provided.")