<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_compiler(compiler, **compiler_attrs):
 """get and customize a compiler"""

    if compiler is None or isinstance(compiler, str):
        cc = ccompiler.new_compiler(compiler=compiler, verbose=0)
        customize_compiler(cc)
        if cc.compiler_type == 'mingw32':
            customize_mingw(cc)
    else:
        cc = compiler
        customize_gcc(cc)

    for name, val in compiler_attrs.items():
        setattr(cc, name, val)

    return cc