def convert_to_demisto_severity(severity: float) -> int:
    """Maps Cyberpion severity to Cortex XSOAR severity

    Converts the Cyberpion alert severity level (1 to 10, float) to Cortex XSOAR incident severity (1 to 4)
    for mapping.

    :type severity: ``float``
    :param severity: severity as returned from the Cyberpion API (float)

    :return: Cortex XSOAR Severity (1 to 4)
    :rtype: ``int``
    """

    # In this case the mapping is straightforward, but more complex mappings
    # might be required in your integration, so a dedicated function is
    # recommended. This mapping should also be documented.
    if 0 <= severity <= 2.5:
        return 1
    elif 2.6 <= severity <= 5:
        return 2
    elif 5.1 <= severity <= 7.5:
        return 3
    elif 7.6 <= severity <= 10:
        return 4
    raise Exception('value of severity is not between 0-10. invalid value of severity: {}'.format(severity))