Creating a Password Generator in Python

import random
import string
generated_passwords = set()
def generate_password():
alphanumerical_characters = string.ascii_letters + string.digits
symbols = string.punctuation
password = ''.join(random.choices(alphanumerical_characters, k=8))
password += random.choice(symbols)
password = ''.join(random.sample(password, len(password)))
if password in generated_passwords:
    return generate_password()
else:
    generated_passwords.add(password)
    return password
print(generated_password())