def read_text(file_path, return_string = True, shell = False):
    """Loads text into memory, either as str or as list. Must be assigned to object.
    
    Args: 
        file_path: Path to file (str)
        return_string: boolean indicating whether to return as string format (instead of list)
        shell: boolean indicating if function is called from command line
    
    Returns: 
        str if return_string, else list
    """
    
    if shell: 
        
        with open(file_path, 'r') as file_handler:
            text = file_handler.read()
        
        return text
    
    if return_string:
        
        textstr = '' # empty string
        
        with open(file_path) as file_handler:
            line = file_handler.readline()
            while line:
                textstr += line
                line = file_handler.readline()

        return textstr
        
    else: # return list of text
        
        textlist = [] # empty list
    
        with open(file_path) as file_handler:
            line = file_handler.readline()
            while line:
                textlist.append(line)
                line = file_handler.readline()

        return textlist