I want to be able to shorten code in python, how can I do that? : <p>I am making a discord bot in python with discord.py. I want to know how i can shorten this function to fewer lines. This function takes a command (-cf red, for example) and flips a coin with both a red side and a blue side. When the results are in the code sends a DM to the person doing the coinflip while at the same time sending the results in the chat.</p>

<pre><code>@bot.command(aliases=['coinflip'])
async def cf(ctx, *, cfchoice):
    cfResults = random.choice(['red','blue'])
    userId = ctx.message.author.id
    user = bot.get_user(userId)

    time.sleep(1)

    # If the user wins the coinflip
    if cfchoice == cfResults:
        # Send result in the channel
        await ctx.send(f'It is {cfResults}!')
        # Send a DM to the person
        await user.send('You won on coinflip! Well done.')

    # If the user loses the coinflip
    elif cfchoice != cfResults:
        # Send result in the channel
        await ctx.send(f'It is {cfResults}!')
        # Send a DM to the person
        await user.send('You lost on coinflip! Good luck next time.')
</code></pre>
