import itertools


def _get_length_sequences_where(x):
    """
    This method calculates the length of all sub-sequences where the array x is either True or 1.
    Examples:
    x = [0,1,0,0,1,1,1,0,0,1,0,1,1]
    _get_length_sequences_where(x)
    [1, 3, 1, 2]
    x: An iterable containing only 1, True, 0 and False values
    return: A list with the length of all sub-sequences where the array is either True or False. If no ones or Trues
    contained, the list [0] is returned.
    """
    if len(x) == 0:
        return [0]
    else:
        res = [len(list(group)) for value, group in itertools.groupby(x) if value == 1]
        return res if len(res) > 0 else [0]