def get_pokemon(pid=None,name=None,pokemons=None):
    '''get_pokemon will return a pokemon with a specific ID, or if none is given,
    will select randomly. First the pid will be used, then the name, then any filters.
    :param pid: the pokemon ID to return
    :param pokemons: the pokemons data structure
    '''
    if pokemons == None:
        pokemons = catch_em_all()

    # First see if we want to find a pokemon by name
    if name is not None:
        catches = lookup_pokemon(field="name",
                                 value=name,
                                 pokemons=pokemons)            
        if catches is not None:
            return catches
        print("We don't have a pokemon called %s" %name)
        sys.exit(1)

    # Next see if they want a random pokemon
    if pid is None:
        choices = list(pokemons.keys())
        pid = int(choice(choices))

    # Retrieve the random, or user selected pokemon
    if pid is not None and str(pid) in pokemons.keys():
        return {pid:pokemons[str(pid)]}

    else:
       print("Cannot find pokemon with this criteria!")
get_pokemon will return a pokemon with a specific ID, or if none is given,
    will select randomly. First the pid will be used, then the name, then any filters.
    :param pid: the pokemon ID to return
    :param pokemons: the pokemons data structure