I have recently written another module that makes it even easier to insert text. You simply create a TextInput-object, then feed it with events every frame of your game and finally retreive the rendered surface using get_surface().
Here's an example program that demonstrates how to use it:
import pygame_textinput # Import the textinput-module
import pygame
pygame.init()
# Create TextInput-object
textinput = pygame_textinput.TextInput()
screen = pygame.display.set_mode((1000, 200))
clock = pygame.time.Clock()
while True:
    screen.fill((225, 225, 225))
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            exit()
    # Feed it with events every frame
    textinput.update(events)
    # Blit its surface onto the screen
    screen.blit(textinput.get_surface(), (10, 10))
    pygame.display.update()
    clock.tick(30)
If you want to process the user input after he pressed return, simply wait until the update()-method returns True:
if textinput.update(events):
    foo()
More detailed information and the source code can be found on [my github page](my github page.