Retrieves a single array for a '@' JSON path marker.

    :param list data_obj: The current data object.
    :param str xj_path: A json path.
    :param str array_path: A lookup key.
    :param bool create_dict_path create a dict path.

def _single_array_element(data_obj, xj_path, array_path, create_dict_path):
    """Retrieves a single array for a '@' JSON path marker.

    :param list data_obj: The current data object.
    :param str xj_path: A json path.
    :param str array_path: A lookup key.
    :param bool create_dict_path create a dict path.
    """

    val_type, array_path = _clean_key_type(array_path)
    array_idx = _get_array_index(array_path)
    if data_obj and isinstance(data_obj, (list, tuple)):
        try:
            value = data_obj[array_idx]
            if val_type is not None and not isinstance(value, val_type):
                raise XJPathError('Index array "%s" of "%s" type does not '
                                  'match expected type "%s"' %
                                  (array_idx, type(value).__name__,
                                   val_type.__name__))

            if xj_path:
                return path_lookup(value, xj_path, create_dict_path)
            else:
                return value, True
        except IndexError:
            return None, False
    else:
        if val_type is not None:
            raise XJPathError('Expected the list element type, but "%s" found' %
                              type(data_obj).__name__)
        return None, False