It sounds like you want some sort of implicit or explicit Markov chain.  For each key, you assign a set of probabilities for what the next key is.  Start with a random key, and then move to the next key according to the assigned probabilities.
My idea is to create a function that takes an input of a number and outputs a string of that length, which consists of "keyboard-like" spam.
I know how to generate a completely random string of characters, however, I'm trying to make it look as if it's real "spam" from someone typing on a keyboard.
For example:

a key closer in proximity to one previously pressed is more likely to be pressed next
keys on the home row may have a higher chance to be pressed
areas where the fingers rest are more likely to be pressed

I'm new to StackOverflow and newish to python so forgive me if there's any errors with how I'm asking this.
I don't have any code yet because I have 0 idea how I would go about doing this.
The best idea I have would be to randomly assign values to each key, and somehow tell the program where each key is physically located in proximity to each other, but this seems inefficient.
I'm not looking for a way to input this into a textbox or on a website somewhere, I only want to generate the random text in a string through a function.
You don't have to write the whole thing but I would greatly appreciate any help or ideas how to do this, thank you.
How could I make a function that generates realistic "keyboard-like" spam? (In python)