import re


def _clean_setup_req(req):
    """
    get rid of cruft in setup.py req format params.

    there's some spec stuff here: https://pythonhosted.org/setuptools/setuptools.html#declaring-dependencies
    but also lots of trial-and-error.

    "Markdown==5.5",
    "Markdown>=5",
    "Foo.bar==5"
    "Foo_bar==5"
    "Foo-bar==5"
    "Foo[PDF]==5"
    "simplejson (>=3.3.1)"
    """
    try:
        return re.compile(r"^[\w\.-]+").findall(req)[0]
    except IndexError:
        return None