import re


def extract_dependencies(content):
    """Extract dependencies by parsing import statements"""
    deps = set()
    for line in content.split('\n'):
        line = line.strip()  # we don't care about indentation
        if not (line.startswith("from") or
                line.startswith("import")):
            continue
        if (line.startswith('#') or line.startswith('"""') or
                line.startswith("'''")):
            continue
        if '#' in line:
            line = line.split("#", 1)[0].strip()
        if line.startswith('from'):  # from foo import bar
            matches = re.findall("from (\w*?)(?: import)", line)
        else:  # import foo
            matches = re.findall("import (\w*?)(?:$| as)", line)
        for match in matches:
            for x in match.split(','):
                if not x.startswith('.'):
                    deps.add(x)
    return deps