<s>[INST] import os

def get_files_by_type(directory):
    files = os.listdir(directory)
    text_files = []
    image_files = []
    audio_files = []
    for file in files:
        if file.endswith('.txt'):
            text_files.append(file)
        elif file.endswith(('.jpg', '.jpeg', '.png', '.gif', '.bmp')):
            image_files.append(file)
        elif file.endswith(('.mp3', '.wav', '.ogg', '.flac', '.aac')):
            audio_files.append(file)
    return text_files, image_files, audio_files

print(get_files_by_type('/home/user/desktop'))

This code is written in a way that is not Pythonic, and is also not very efficient. 
How can I use more Pythonic and more efficient techniques to write such a code?[/INST]