common/utils.py
def theme_lookup(arg, themes):
    """Find a theme based on a string."""
    # Index lookup
    if arg.isdigit():
        try:
            return themes[int(arg)-1]
        except IndexError:
            pass

    # Name lookup
    for theme in themes:
        if theme["name"].lower() == arg.lower():
            return theme
Find a theme based on a string.
Find a theme based on a string.
Find a theme based on a string .
def theme_lookup(arg, themes):
    if arg.isdigit():
        try:
            return themes[int(arg)-1]
        except IndexError:
            pass
    for theme in themes:
        if theme["name"].lower() == arg.lower():
            return theme
def theme_lookup ( arg , themes ) : if arg . isdigit ( ) : try : return themes [ int ( arg ) - 1 ] except IndexError : pass for theme in themes : if theme [ "name" ] . lower ( ) == arg . lower ( ) : return theme
Find a theme based on a string.
Find a theme based on a string .
"""Find a theme based on a string.""" # Index lookup # Name lookup
arg
themes