Create A Blender Material With A Python Script

** TL;DR

This Python script makes a basic "Principled BSDF" material in Blender. It takes an array a name for the material and an array of tuples for the settings

import bpy

def create_material(name, params):
    if name not in
        print(f"Making {name}")
        material =[name]
        material.use_nodes = True
        for param in params:
            material.node_tree.nodes['Principled BSDF'].inputs[param[0]].default_value = param[1]
        print(f"Already have {name}")

if __name__ == "__main__":
    create_material("BlackSquare", [
        ('Base Color', (0, 0, 0, 1)),
        ('Roughness', 1.0),
    create_material("WhiteSquare", [
        ('Base Color', (1, 1, 1, 1)),
        ('Roughness', 0.7),