def tokenize_text(tokenizer, text, return_sentence=False):
    """
    Method to tokenise text using given tokenizer

    parameters
    -----------
    :param tokenizer: object
        NLTK tokenizer
    :param text: str
        String which need to be tokenised
    :param return_sentence: boolean, optional
        Boolean to indicate the output type.
        True - return the tokenised text as a sentence/string. Tokens are appended using spaces.
        False - returns tokens as a list
    :return: str or list
        Tokenised text
        Return type depends on the 'return_sentence' argument. Default is a list.
    """
    tokens = tokenizer.tokenize(text)
    if return_sentence:
        return " ".join(tokens)
    else:
        return tokens