docs: def buses_by_country(network):
      """
      Find buses of foreign countries using coordinates
      and return them as Pandas Series
  
      Parameters
      ----------
      network : :class:`pypsa.Network
          Overall container of PyPSA
  
      Returns
      -------
      foreign_buses: Series containing buses by country
      """
  
      poland = pd.Series(index=network.
                         buses[(network.buses['x'] > 17)].index,
                         data="PL")
      czech = pd.Series(index=network.
                        buses[(network.buses['x'] < 17) &
                              (network.buses['x'] > 15.1)].index,
                        data="CZ")
      denmark = pd.Series(index=network.
                          buses[((network.buses['y'] < 60) &
                                 (network.buses['y'] > 55.2)) |
                                ((network.buses['x'] > 11.95) &
                                 (network.buses['x'] < 11.97) &
                                 (network.buses['y'] > 54.5))].
                          index,
                          data="DK")
      sweden = pd.Series(index=network.buses[(network.buses['y'] > 60)].index,
                         data="SE")
      austria = pd.Series(index=network.
                          buses[(network.buses['y'] < 47.33) &
                                (network.buses['x'] > 9) |
                                ((network.buses['x'] > 9.65) &
                                 (network.buses['x'] < 9.9) &
                                 (network.buses['y'] < 47.5) &
                                 (network.buses['y'] > 47.3)) |
                                ((network.buses['x'] > 12.14) &
                                 (network.buses['x'] < 12.15) &
                                 (network.buses['y'] > 47.57) &
                                 (network.buses['y'] < 47.58)) |
                                (network.buses['y'] < 47.6) &
                                (network.buses['x'] > 14.1)].index,
                          data="AT")
      switzerland = pd.Series(index=network.
                              buses[((network.buses['x'] > 8.1) &
                                     (network.buses['x'] < 8.3) &
                                     (network.buses['y'] < 46.8)) |
                                    ((network.buses['x'] > 7.82) &
                                     (network.buses['x'] < 7.88) &
                                     (network.buses['y'] > 47.54) &
                                     (network.buses['y'] < 47.57)) |
                                    ((network.buses['x'] > 10.91) &
                                     (network.buses['x'] < 10.92) &
                                     (network.buses['y'] > 49.91) &
                                     (network.buses['y'] < 49.92))].index,
                              data="CH")
      netherlands = pd.Series(index=network.
                              buses[((network.buses['x'] < 6.96) &
                                     (network.buses['y'] < 53.15) &
                                     (network.buses['y'] > 53.1)) |
                                    ((network.buses['x'] < 5.4) &
                                     (network.buses['y'] > 52.1))].index,
                              data="NL")
      luxembourg = pd.Series(index=network.
                             buses[((network.buses['x'] < 6.15) &
                                    (network.buses['y'] < 49.91) &
                                    (network.buses['y'] > 49.65))].index,
                             data="LU")
      france = pd.Series(index=network.
                         buses[(network.buses['x'] < 4.5) |
                               ((network.buses['x'] > 7.507) &
                                (network.buses['x'] < 7.508) &
                                (network.buses['y'] > 47.64) &
                                (network.buses['y'] < 47.65)) |
                               ((network.buses['x'] > 6.2) &
                                (network.buses['x'] < 6.3) &
                                (network.buses['y'] > 49.1) &
                                (network.buses['y'] < 49.2)) |
                               ((network.buses['x'] > 6.7) &
                                (network.buses['x'] < 6.76) &
                                (network.buses['y'] > 49.13) &
                                (network.buses['y'] < 49.16))].index,
                         data="FR")
      foreign_buses = pd.Series()
      foreign_buses = foreign_buses.append([poland, czech, denmark, sweden,
                                            austria, switzerland,
                                            netherlands, luxembourg, france])
      network.buses['country_code'] = foreign_buses[network.buses.index]
      network.buses['country_code'].fillna('DE', inplace=True)
  
      return foreign_buses