'Get logs from a container. Similar to the ``docker logs`` command.
The ``stream`` parameter makes the ``logs`` function return a blocking
generator you can iterate over to retrieve log output as it happens.
Args:
container (str): The container to get logs from
stdout (bool): Get ``STDOUT``
stderr (bool): Get ``STDERR``
stream (bool): Stream the response
timestamps (bool): Show timestamps
tail (str or int): Output specified number of lines at the end of
logs. Either an integer of number of lines or the string
``all``. Default ``all``
since (datetime or int): Show logs since a given datetime or
integer epoch (in seconds)
follow (bool): Follow log output
Returns:
(generator or str)
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.'

@utils.check_resource('container')
def logs(self, container, stdout=True, stderr=True, stream=False, timestamps=False, tail='all', since=None, follow=None):

    if (utils.compare_version('1.11', self._version) >= 0):
        if (follow is None):
            follow = stream
        params = {'stderr': ((stderr and 1) or 0), 'stdout': ((stdout and 1) or 0), 'timestamps': ((timestamps and 1) or 0), 'follow': ((follow and 1) or 0)}
        if (utils.compare_version('1.13', self._version) >= 0):
            if ((tail != 'all') and ((not isinstance(tail, int)) or (tail < 0))):
                tail = 'all'
            params['tail'] = tail
        if (since is not None):
            if (utils.compare_version('1.19', self._version) < 0):
                raise errors.InvalidVersion('since    is    not    supported    in    API    <    1.19')
            elif isinstance(since, datetime):
                params['since'] = utils.datetime_to_timestamp(since)
            elif (isinstance(since, int) and (since > 0)):
                params['since'] = since
            else:
                raise errors.InvalidArgument('since    value    should    be    datetime    or    int,    not    {}'.format(type(since)))
        url = self._url('/containers/{0}/logs', container)
        res = self._get(url, params=params, stream=stream)
        return self._get_result(container, stream, res)
    return self.attach(container, stdout=stdout, stderr=stderr, stream=stream, logs=True)
