def _extract_class(frame_locals):
    """
    See https://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object/2544639#2544639
    for the details behind the implementation. The way to use to extract class from method relies on the fact that
    "self" is passed as an argument in the function and it points to the class which owns this function.
    """
    try:
        return frame_locals['self'].__class__.__name__
    except Exception:
        # Fail to get the class name should not block the whole sample
        return None