concept concern in category python

This is an excerpt from Manning's book Practices of the Python Pro.
A concern is a distinct behavior or piece of knowledge your software deals with. Concerns can range in granularity from how to calculate a square root to how payments are managed in an e-commerce system.
In this chapter, I’ll discuss the tools built into Python for separating the concerns in your code, as well as the philosophy that goes into deciding how and when to use them.
In chapter 2, I showed you some of the best practices around separation of concerns in Python. Separating concerns means creating boundaries between code that deals with distinct activities to make the code more understandable. You learned how functions, classes, modules, and packages are useful in decomposing code into pieces that are easier to reason about. Although chapter 2 covered several of the tools available for separating concerns, it’s helpful to get some experience applying them.
As is true for many, I learn best by doing. As I work through a real project, I often discover connections I didn’t see before or find new questions to explore. In this chapter, you’ll work through a real application that exhibits a good use case for separating concerns. You’ll improve upon it in the chapters to come, and you’ll end up with something you can extend for your own personal use.
Listing 9.5. Separating concerns into two functions
def get_format_function(accept=None): #1 formats = { 'application/json': to_json, 'application/xml': to_xml, } return formats.get(accept, lambda val: val) def random_food(request): #2 food = random.choice(FOODS) format_function = get_format_function(request.headers.get('Accept')) #3 return format_function(food)