<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_screenshots(quiet=False):
 """ create screenshots for all core modules. The screenshots directory will have all .png files deleted before new shots are created. """

    if os.environ.get("READTHEDOCS") == "True":
        path = "../doc/screenshots"
    else:
        path = os.path.join(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
            "doc/screenshots",
        )

    print("Creating screenshots...")
    samples = get_samples()
    for name, data in sorted(samples.items()):
        process(name, path, data)