def METHOD_NAME(self, input):
    """parse the given file or file source string"""
    if hasattr(input, "name"):
        self.filename = input.name
    elif not getattr(self, "filename", ""):
        self.filename = ""
    if hasattr(input, "read"):
        src = input.read()
        input.close()
        input = src
    if isinstance(input, bytes):
        input = input.decode("utf-8")
    try:
        self._original = self.yaml.load(input)
    except YAMLError as e:
        message = getattr(e, "problem", getattr(e, "message", str(e)))
        if hasattr(e, "problem_mark"):
            message += f" {e.problem_mark}"
        raise base.ParseError(message)
    content = self.preprocess(self._original)
    for k, data in self._flatten(content):
        unit = self.UnitClass(data)
        unit.set_unitid(k)
        self.addunit(unit)