import re


def get_requirement_id(text, fuzzy=False):
    """Find requirement ID of the general form 'ABC-DEF-1' within a string like '[ABC-DEF-1, X]'

    If fuzzy is false, will only find IDs with a numerical suffix
    If fuzzy is true, will find any suffix (useful for finding pending
      annotations of the form ABC-DEF-?)

    Returns the requirement ID if found.
    Returns None otherwise.
    """
    if fuzzy:
        regex = r"^\s*\[\s*(?P<requirement_id>[\w\.]+-[\w\.]+-\S*)\s*,.+]\s*$"
    else:
        regex = r"^\s*\[\s*(?P<requirement_id>[\w\.]+-[\w\.]+-\d+)\s*,.+]\s*$"
    result = re.search(regex, text)
    if result:
        return result.group('requirement_id')
    return None