def calculate_sunrise_sunset_from_datetime(self, datetime, depression=<NUM_LIT>,<EOL>is_solar_time=False):
<EOL>if datetime.year != <NUM_LIT> and self.is_leap_year:<EOL><INDENT>datetime = DateTime(datetime.month, datetime.day, datetime.hour,<EOL>datetime.minute, True)<EOL><DEDENT>sol_dec, eq_of_time = self._calculate_solar_geometry(datetime)<EOL>if is_solar_time:<EOL><INDENT>noon = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>noon = (<NUM_LIT> -<EOL><NUM_LIT:4> * math.degrees(self._longitude) -<EOL>eq_of_time +<EOL>self.time_zone * <NUM_LIT><EOL>) / <NUM_LIT><EOL><DEDENT>try:<EOL><INDENT>sunrise_hour_angle = self._calculate_sunrise_hour_angle(<EOL>sol_dec, depression)<EOL><DEDENT>except ValueError:<EOL><INDENT>noon = <NUM_LIT> * noon<EOL>return {<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": DateTime(datetime.month, datetime.day,<EOL>*self._calculate_hour_and_minute(noon),<EOL>leap_year=self.is_leap_year),<EOL>"<STR_LIT>": None<EOL>}<EOL><DEDENT>else:<EOL><INDENT>sunrise = noon - sunrise_hour_angle * <NUM_LIT:4> / <NUM_LIT><EOL>sunset = noon + sunrise_hour_angle * <NUM_LIT:4> / <NUM_LIT><EOL>noon = <NUM_LIT> * noon<EOL>sunrise = <NUM_LIT> * sunrise<EOL>sunset = <NUM_LIT> * sunset<EOL>return {<EOL>"<STR_LIT>": DateTime(datetime.month, datetime.day,<EOL>*self._calculate_hour_and_minute(sunrise),<EOL>leap_year=self.is_leap_year),<EOL>"<STR_LIT>": DateTime(datetime.month, datetime.day,<EOL>*self._calculate_hour_and_minute(noon),<EOL>leap_year=self.is_leap_year),<EOL>"<STR_LIT>": DateTime(datetime.month, datetime.day,<EOL>*self._calculate_hour_and_minute(sunset),<EOL>leap_year=self.is_leap_year)<EOL>}<EOL><DEDENT>
Calculate sunrise, sunset and noon for a day of year.