def _check_length_supports(length, supports):  # {{{
    """
    Validate the length and supports. See solve().

    Returns:
        A tuple (length, support1, support2)
    """
    length = int(round(length))
    if length < 1:
        raise ValueError("length must be ≥1")
    if supports is not None:
        if len(supports) != 2:
            t = "The problem definition must contain exactly two supports."
            raise ValueError(t)
        s = (int(round(supports[0])), int(round(supports[1])))
        if s[0] == s[1]:
            raise ValueError("Two identical supports found!")
        elif s[0] > s[1]:
            s = (s[1], s[0])
        if s[0] < 0 or s[1] > length:
            raise ValueError("Support(s) outside of the beam!")
    else:
        s = (0, None)
    return (length, s[0], s[1])