def width_from_bitdefs(bitdefs):
    """
    Determine how wide an binary value needs to be based on bitdefs used
    to define it.

    Args:
        bitdefs (list(BitDef)): List of bitdefs to find max width of
    Returns:
        (int): Maximum width
    """

    max_index = max([bitdef.end for bitdef in bitdefs])
    width = max_index + 1
    return width