Remove an unused import
Use string formatting on the main url
Ignore .idea
snake_case, not camelCase
Remove call to (already killed) create_database() function
Simplify an if statement
Remove a variable that was immediately redefined.
Miscellaneous code formatting, comment tweaking, whitespace fixing changes
Move _flatten above the calling function