<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_tables(self, dataset_id, app_id, start_time, end_time, project_id=None):
 """Retrieve a list of tables that are related to the given app id and are inside the range of start and end times. Parameters dataset_id : str The BigQuery dataset id to consider. app_id : str The appspot name start_time : Union[datetime, int] The datetime or unix time after which records will be fetched. end_time : Union[datetime, int] The datetime or unix time up to which records will be fetched. project_id: str, optional String id of the project Returns ------- list A ``list`` of table names. """


        if isinstance(start_time, datetime):
            start_time = calendar.timegm(start_time.utctimetuple())

        if isinstance(end_time, datetime):
            end_time = calendar.timegm(end_time.utctimetuple())

        every_table = self._get_all_tables(dataset_id, project_id)
        app_tables = every_table.get(app_id, {})

        return self._filter_tables_by_time(app_tables, start_time, end_time)