code: def get_locations(self, filter_to_my_group=False):
          resp = self._post('general-retrievelocations', 'locations')
          groups = {}
          if resp['groupinfo']:
              for group in resp['groupinfo']:
                  groups[group['id']] = Group(
                                              name=group.get('name'),
                                              inventory_id=group.get('id')
                                              )
          final_resp = []
          if resp['data']:
              if filter_to_my_group:
                  resp['data'] = {self.groupid: resp['data'][self.groupid]}
              for groupid, sublocation in resp['data'].items():
                  if type(sublocation) is dict:
                      sublocation = [loc for _, loc in sublocation.items()]
                      sublocation = flatten_list(sublocation)
                  if type(sublocation) is list:
                      sublocation = flatten_list(sublocation)
                  for location in sublocation:
                      group = groups[groupid]
                      final_resp.append(Location(
                                              name=location.get('name'),
                                              inventory_id=location.get('id'),
                                              parent=location.get('parent'),
                                              group=group,
                                              barcode=location.get('barcode')
                                        ))
          return final_resp