On Unix system type files can be identified with the ls -l command which displays the type of the file in the first alphabetic letter of the file system permissions field. You can find more information about file type on Unix system on the [wikipedia page](https://en.wikipedia.org/wiki/Unix_file_types).

- '-' A regular file ==> `file`.
- 'd' A directory ==> `directory`.
- 'l' A symbolic link ==> `symlink`.
- 'c' A character special file. It refers to a device that handles data as a stream of bytes (e.g: a terminal/modem) ==> `character_file`.
- 'b' A block special file. It refers to a device that handles data in blocks (e.g: such as a hard drive or CD-ROM drive) ==> `block_file`.
- 'p' a named pipe ==> `pipe`.
- 's' a socket ==> `socket`.
- 'D' a door ==> `door`.

In this kata you should complete a function that return the `filetype` as a string regarding the `file_attribute` given by the `ls -l` command. 

For example if the function receive `-rwxr-xr-x` it should return `file`.

Difficulty: introductory

Starter code:

def linux_type(file_attribute):
	

Solutions:
dict = {'-':"file",'d':"directory",'l':"symlink",'c':"character_file",'b':"block_file",'p':"pipe",'s':"socket",'D':"door"}
def linux_type(file_attribute):
    return dict[file_attribute[0]]

def linux_type(s):
    return {x: y for x, y in zip("-dlcbpsD", "file directory symlink character_file block_file pipe socket door".split(" "))}[s[0]]

D = {'p':"pipe", '-':"file", 'd':"directory", 'l':"symlink",
     'c':"character_file", 'b':"block_file", 's':"socket", 'D':"door"}

def linux_type(file_attribute):
    return D[file_attribute[0]]

def linux_type(file_attribute):
    flags = {
        '-': 'file',
        'd': 'directory',
        'l': 'symlink',
        'c': 'character_file',
        'b': 'block_file',
        'p': 'pipe',
        's': 'socket',
        'D': 'door'
    } 
    return flags[file_attribute[0]]

def linux_type(file_attribute):
    switch = {
        '-': 'file',
        'd': 'directory',
        'l': 'symlink',
        'c': 'character_file',
        'b': 'block_file',
        'p': 'pipe',
        's': 'socket',
        'D': 'door',
    }
    return switch[file_attribute[0]]

d = dict(__import__("re").findall(r"'(.)'.*\s([a-z_]+)\.",
    """
        '-' A regular file ==> file.
        'd' A directory ==> directory.
        'l' A symbolic link ==> symlink.
        'c' A character special file. It refers to a device that handles data as a stream of bytes (e.g: a terminal/modem) ==> character_file.
        'b' A block special file. It refers to a device that handles data in blocks (e.g: such as a hard drive or CD-ROM drive) ==> block_file.
        'p' a named pipe ==> pipe.
        's' a socket ==> socket.
        'D' a door ==> door.
    """))

linux_type = lambda s: d[s[0]]

def linux_type(f): #
    return {'-':'file','d':'directory','l':'symlink','c':'character_file','b':'block_file','p':'pipe','s':'socket','D':'door'}[f[0]]


def linux_type(f):
    return {'-':'file','d':'directory','l':'symlink','c':'character_file','b':'block_file','p':'pipe','s':'socket','D':'door'}.get(f[0])


def linux_type(f):
    return {"-":"file","d":"directory","l":"symlink","c":"character_file","b":"block_file","p":"pipe","s":"socket","D":"door"}[f[0]]

import re
def linux_type(file_attribute):
    types={"-": "file",
          "d": "directory",
          "l": "symlink",
          "c": 'character_file',
           "b": 'block_file',
           "p": "pipe",
           "s": "socket",
           "D": "door"           
          }
    return types[file_attribute[0]]

linux_type=lambda f:{'-':'file','d':'directory','l':'symlink', 'c':'character_file', 'b': 'block_file', 'p':'pipe', 's':'socket', 'D':'door'}[f[0]]

def linux_type(file_attribute):
    return {
        'd': 'directory',
        'l': 'symlink',
        'c': 'character_file',
        'b': 'block_file',
        'p': 'pipe',
        's': 'socket',
        'D': 'door'
    }.get(file_attribute[0],'file')

def linux_type(file_attribute):
    types = {'-': 'file',
             'd': 'directory',
             'l': 'symlink',
             'c': 'character_file',
             'b': 'block_file',
             'p': 'pipe',
             's': 'socket',
             'D': 'door'}
    if not file_attribute:
        return None
    ty = file_attribute[0]
    if ty in types:
        return types[ty]
    else:
        return None

def linux_type(fa):
    d = {'-':'file',
          'd':'directory',
           'l':'symlink',
            'c': 'character_file',
            'b':'block_file',
            'p':'pipe',
            's':'socket',
            'D':'door'
         }
    return d.get(fa[0])

ATTRIBUTES = {
    "-": "file",
    "d": "directory",
    "l": "symlink",
    "c": "character_file",
    "b": "block_file",
    "p": "pipe",
    "s": "socket",
    "D": "door",
}

def linux_type(file_attribute):
    return ATTRIBUTES[file_attribute[0]]

files_types = { '-' : 'file',
                'd' : 'directory',
                'l' : 'symlink',
                'c' : 'character_file',
                'b' : 'block_file',
                'p' : 'pipe',
                's' : 'socket',
                'D' : 'door' }
                
def linux_type(file_attribute):
    return files_types[file_attribute[0]]


D = {'-': 'file', 'd': 'directory', 'l': 'symlink',
     'c': 'character_file', 'b': 'block_file', 'p': 'pipe',
     's': 'socket', 'D': 'door'}

def linux_type(s):
    return D[s[0]]

def linux_type(file_attribute):
    f_att = file_attribute[0]
    if f_att == '-':
        return "file"
    elif f_att == 'd':
        return "directory"
    elif f_att == 'l':
        return "symlink"
    elif f_att == 'c':
        return "character_file"
    elif f_att == 'b':
        return "block_file"
    elif f_att == 'p':
        return "pipe"
    elif f_att == 's':
        return "socket"
    elif f_att == 'D':
        return "door"
    return None

def linux_type(file):
    dict = {'-': 'file',
    'd': 'directory',
    'l': 'symlink',
    'c': 'character_file',
    'b': 'block_file',
    'p': 'pipe',
    's': 'socket',
    'D': 'door'}
    return dict.get(file[0])

def linux_type(file_attribute):
    Unix_system_type = [['-', 'file'],
                        ['d', 'directory'],
                        ['l', 'symlink'],
                        ['c', 'character_file'],
                        ['b', 'block_file'],
                        ['p', 'pipe'],
                        ['s', 'socket'],
                        ['D', 'door']]
    i = 0
    while i < len(Unix_system_type):
        if file_attribute[0] == Unix_system_type[i][0]:
            return Unix_system_type[i][1]
        i += 1