Im trying to write a python file on my raspberry pi to mute or change the volume of the speaker output when its run. If i type:
    amixer sset 'Master' 50%
in to terminal, the volume is increased by 50%
however if i make a python file called filename.py will the following lines:

    import os
    os.system(amixer sset 'Master' 50%)
and run it in terminal with 

    sudo python filename.py

it comes up with an error

    amixer: Unable to find simple control 'Master',0

How can I just run exactly the same command in terminal as I do in python?