def _clean_suffix(string, suffix):
    """
    If string endswith the suffix, remove it. Else leave it alone.
    """
    suffix_len = len(suffix)
    if len(string) < suffix_len:
        raise ValueError('A suffix can not be bigger than string argument.')
    if string.endswith(suffix):
        return string[0:-suffix_len]
    else:
        return string
