def strip_comments(line):
    """Removes all text after a # the passed in string

    >>> strip_comments("Test string")
    'Test string'

    >>> strip_comments("Test #comment")
    'Test '

    >>> strip_comments("#hashtag")
    ''

    >>> strip_comments("Test#comment")
    'Test'
    """
    if "#" in line:
        return line[:line.find("#")]
    else:
        return line