-----
    Brief
    -----
    Function that verifies when "all" or "any" elements of the list "element" have the type
    specified in "type_to_check" input.

    -----------
    Description
    -----------
    In some biosignalsnotebooks functions their implementation is extremely dependent on a specific
    criterion, i.e., 'all' list entries should be of a specific data type.

    In order to ensure this functionality _is_instance function was implemented.

    For example, when plotting data through 'plot' function of 'visualise' module, 'all' entries
    of time axis and data samples lists need to be 'Numeric'.
    In order to this condition be checked _is_instance should be called with the following input
    values:

    _is_instance(Number, [1, 2, 3, True, ...], 'all')

    Sometimes is also relevant to check if at least one of list entries belongs to a data type, for
    cases like this, the argument "condition" should have value equal to "any".

    --------
    Examples
    --------
    >>> _is_instance(Number, [1, 2, 3, True], 'all')
    False
    >>> _is_instance(Number, [1, 1.2, 3, 5], 'all')
    True

    ----------
    Parameters
    ----------
    type_to_check : type element
        Data type (all or any elements of 'element' list must be of the type specified in the
        current input).

    element : list
        List where condition specified in "condition" will be checked.

    condition : str
        String with values "any" or "all" verifying when "any" or "all" element entries have the
        specified type.

    deep : bool
        Flag that identifies when element is in a matrix format and each of its elements should be
        verified iteratively.

    Returns
    -------
    out : boolean
        Returns True when the "condition" is verified for the entries of "element" list.

def _is_instance(type_to_check, element, condition="any", deep=False):
    """
    -----
    Brief
    -----
    Function that verifies when "all" or "any" elements of the list "element" have the type
    specified in "type_to_check" input.

    -----------
    Description
    -----------
    In some biosignalsnotebooks functions their implementation is extremely dependent on a specific
    criterion, i.e., 'all' list entries should be of a specific data type.

    In order to ensure this functionality _is_instance function was implemented.

    For example, when plotting data through 'plot' function of 'visualise' module, 'all' entries
    of time axis and data samples lists need to be 'Numeric'.
    In order to this condition be checked _is_instance should be called with the following input
    values:

    _is_instance(Number, [1, 2, 3, True, ...], 'all')

    Sometimes is also relevant to check if at least one of list entries belongs to a data type, for
    cases like this, the argument "condition" should have value equal to "any".

    --------
    Examples
    --------
    >>> _is_instance(Number, [1, 2, 3, True], 'all')
    False
    >>> _is_instance(Number, [1, 1.2, 3, 5], 'all')
    True

    ----------
    Parameters
    ----------
    type_to_check : type element
        Data type (all or any elements of 'element' list must be of the type specified in the
        current input).

    element : list
        List where condition specified in "condition" will be checked.

    condition : str
        String with values "any" or "all" verifying when "any" or "all" element entries have the
        specified type.

    deep : bool
        Flag that identifies when element is in a matrix format and each of its elements should be
        verified iteratively.

    Returns
    -------
    out : boolean
        Returns True when the "condition" is verified for the entries of "element" list.
    """

    out = None

    # Direct check of "condition" in "element".
    if deep is False:
        if condition == "any":
            out = any(isinstance(el, type_to_check) for el in element)
        elif condition == "all":
            out = all(isinstance(el, type_to_check) for el in element)

    # Since "element" is in a matrix format, then it will be necessary to check each dimension.
    else:
        for row in range(0, len(element)):
            for column in range(0, len(element[row])):
                flag = _is_instance(type_to_check, element[column][row], "all", deep=False)
                if flag is False:
                    out = flag
                else:
                    out = True
    return out