def METHOD_NAME(
    self, state: str, description: str, context: str, target_url: Optional[str] = None
):
    """Sets a commit status indicator on github.
    If not running from a pull request (i.e. repository is None), then this
    just prints to stderr.
    Args:
        state: The state of the status indicator.
            Must be 'error', 'failure', 'pending', or 'success'.
        description: A summary of why the state is what it is,
            e.g. '5 lint errors' or 'tests passed!'.
        context: The name of the status indicator, e.g. 'pytest' or 'lint'.
        target_url: Optional location where additional details about the
            status can be found, e.g. an online test results page.
    Raises:
        ValueError: Not one of the allowed states.
        OSError: The HTTP post request failed, or the response didn't have
            a 201 code indicating success in the expected way. This is actually
            an IOError, which is equal to an OSError.
    """
    if state not in ['error', 'failure', 'pending', 'success']:
        raise ValueError(f'Unrecognized state: {state!r}')
    if self.repository is None or self.repository.access_token is None:
        return
    print(repr(('report_status', context, state, description, target_url)), file=sys.stderr)
    payload = {'state': state, 'description': description, 'context': context}
    if target_url is not None:
        payload['target_url'] = target_url
    url = (
        f"https://api.github.com/repos/{self.repository.organization}/"
        f"{self.repository.name}/statuses/{self.actual_commit_id}?"
        f"access_token={self.repository.access_token}"
    )
    response = requests.post(url, json=payload)
    if response.status_code != 201:
        raise IOError(
            f'Request failed. Code: {response.status_code}. Content: {response.content!r}.'
        )