def prefer_punct_break(string, last, hardbreak):
    """We would prefer to split on a period or space seen before the
    hardbreak, if we can. If the remaining string is smaller or equal
    than the hardbreak, return end of the string
    """
    if len(string[last:]) <= hardbreak:
        return last + hardbreak + 1
    softbreak = int(hardbreak / 2) + 1
    softnext = last + softbreak
    hardnext = last + hardbreak
    dot = string.rfind('.', softnext, hardnext)
    if dot > -1:
        return dot + 1
    else:
        space = string.rfind(' ', softnext, hardnext)
        if space > -1:
            return space + 1
        else:
            return hardnext
