import io


def count_lines(content):
    """Returns the number of lines for a string."""
    try:
        fh = io.StringIO(content)
    except TypeError:
        fh = io.BytesIO(content)

    count = 0

    for count, _ in enumerate(fh, 1):
        pass

    return count