def _pull_from_stream(self, amount_requested):
        stream_filein = sys.stdin
        if six.PY3:
            stream_filein = sys.stdin.buffer
        payload = stream_filein.read(amount_requested)
        payload_file = six.BytesIO(payload)
        return payload_file, len(payload) == amount_requested
This function pulls data from stdin until it hits the amount
dataset/ETHPy150Open aws/aws-cli/awscli/customizations/s3/s3handler.py/S3StreamHandler._pull_from_stream