<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bearing(self, format='numeric'):
 """Calculate bearing between locations in segments. Args: format (str):
 Format of the bearing string to return Returns: list of list of float: Groups of bearings between points in segments """

        bearings = []
        for segment in self:
            if len(segment) < 2:
                bearings.append([])
            else:
                bearings.append(segment.bearing(format))
        return bearings