<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fan_speed(self, speed: int = None) -> bool: """Adjust Fan Speed by Specifying 1,2,3 as argument or cycle through speeds increasing by one"""

        body = helpers.req_body(self.manager, 'devicestatus')
        body['uuid'] = self.uuid
        head = helpers.req_headers(self.manager)
        if self.details.get('mode') != 'manual':
            self.mode_toggle('manual')
        else:
            if speed is not None:
                level = int(self.details.get('level'))
                if speed == level:
                    return False
                elif speed in [1, 2, 3]:
                    body['level'] = speed
            else:
                if (level + 1) > 3:
                    body['level'] = 1
                else:
                    body['level'] = int(level + 1)

            r, _ = helpers.call_api('/131airPurifier/v1/device/updateSpeed',
                                    'put', json=body, headers=head)

            if r is not None and helpers.check_response(r, 'airpur_status'):
                self.details['level'] = body['level']
                return True
            else:
                return False