def parse_ieee_block_header(block):
    """Parse the header of a IEEE block.

    Definite Length Arbitrary Block:
    #<header_length><data_length><data>

    The header_length specifies the size of the data_length field.
    And the data_length field specifies the size of the data.

    Indefinite Length Arbitrary Block:
    #0<data>

    In this case the data length returned will be 0. The actual length can be
    deduced from the block and the offset.

    :param block: IEEE block.
    :type block: bytes | bytearray
    :return: (offset, data_length)
    :rtype: (int, int)
    """
    begin = block.find(b'#')
    if begin < 0:
        raise ValueError(
            'Could not find hash sign (#) indicating the start of the block.')
    try:
        header_length = int(block[begin + 1:begin + 2])
    except ValueError:
        header_length = 0
    offset = begin + 2 + header_length
    if header_length > 0:
        data_length = int(block[begin + 2:offset])
    else:
        data_length = 0
    return offset, data_length
