So i'm working in python with SpeechRecognition : https://pypi.python.org/pypi/SpeechRecognition/ It works perfectly with this code:
import pyaudio
import speech_recognition as sr
r = sr.Recognizer(language = "es-ES", key = "AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw")
with sr.Microphone() as source:
    audio = r.listen(source)
print r.recognize(audio)
But when I try to turn it into a function:
def stt():
    r = sr.Recognizer(language = "es-ES", key = "AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw")
    with sr.Microphone() as source:
        audio = r.listen(source)
    return r.recognize(audio)
I get this error: File "./prueba_2.py", line 22
    with sr.Microphone() as source:
                                  ^
IndentationError: unindent does not match any outer indentation level
How could i fix it?
