<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_applications(self, states=None, name=None, user=None, queue=None, started_begin=None, started_end=None, finished_begin=None, finished_end=None):
 """Get the status of current skein applications. Parameters states : sequence of ApplicationState, optional If provided, applications will be filtered to these application states. Default is ``['SUBMITTED', 'ACCEPTED', 'RUNNING']``. name : str, optional Only select applications with this name. user : str, optional Only select applications with this user. queue : str, optional Only select applications in this queue. started_begin : datetime or str, optional Only select applications that started after this time (inclusive). Can be either a datetime or a string representation of one. String representations can use any of the following formats: - ``YYYY-M-D H:M:S`` (e.g. 2019-4-10 14:50:20) - ``YYYY-M-D H:M`` (e.g. 2019-4-10 14:50) - ``YYYY-M-D`` (e.g. 2019-4-10) - ``H:M:S`` (e.g. 14:50:20, today is used for date) - ``H:M`` (e.g. 14:50, today is used for date) started_end : datetime or str, optional Only select applications that started before this time (inclusive). Can be either a datetime or a string representation of one. finished_begin : datetime or str, optional Only select applications that finished after this time (inclusive). Can be either a datetime or a string representation of one. finished_end : datetime or str, optional Only select applications that finished before this time (inclusive). Can be either a datetime or a string representation of one. Returns ------- reports : list of ApplicationReport Examples -------- Get all the finished and failed applications [ApplicationReport<name='demo'>, ApplicationReport<name='dask'>, ApplicationReport<name='demo'>] Get all applications named 'demo' started after 2019-4-10: [ApplicationReport<name='demo'>, ApplicationReport<name='demo'>] """

        if states is not None:
            states = tuple(ApplicationState(s) for s in states)
        else:
            states = (ApplicationState.SUBMITTED,
                      ApplicationState.ACCEPTED,
                      ApplicationState.RUNNING)

        started_begin = self._parse_datetime(started_begin, 'started_begin')
        started_end = self._parse_datetime(started_end, 'started_end')
        finished_begin = self._parse_datetime(finished_begin, 'finished_begin')
        finished_end = self._parse_datetime(finished_end, 'finished_end')

        req = proto.ApplicationsRequest(
            states=[str(s) for s in states],
            name=name,
            user=user,
            queue=queue,
            started_begin=datetime_to_millis(started_begin),
            started_end=datetime_to_millis(started_end),
            finished_begin=datetime_to_millis(finished_begin),
            finished_end=datetime_to_millis(finished_end)
        )
        resp = self._call('getApplications', req)
        return sorted((ApplicationReport.from_protobuf(r) for r in resp.reports),
                      key=lambda x: x.id)