Calls to my REST api may either return a dict (for single results) or a list of dicts (for multiple results). I receive these results using the requests library. I want to retrieve the value for a key 'ID' but only if I have a single result and, obviously, if ID is present. How can I do this with pythonic elegance? Thanks for all suggestions!