def merged(self, other):
if self.name_ != other.name_:<EOL><INDENT>return None  <EOL><DEDENT>def _r(r_):<EOL><INDENT>r = Requirement(None)<EOL>r.name_ = r_.name_<EOL>r.negate_ = r_.negate_<EOL>r.conflict_ = r_.conflict_<EOL>r.sep_ = r_.sep_<EOL>return r<EOL><DEDENT>if self.range is None:<EOL><INDENT>return other<EOL><DEDENT>elif other.range is None:<EOL><INDENT>return self<EOL><DEDENT>elif self.conflict:<EOL><INDENT>if other.conflict:<EOL><INDENT>r = _r(self)<EOL>r.range_ = self.range_ | other.range_<EOL>r.negate_ = (self.negate_ and other.negate_<EOL>and not r.range_.is_any())<EOL>return r<EOL><DEDENT>else:<EOL><INDENT>range_ = other.range - self.range<EOL>if range_ is None:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>r = _r(other)<EOL>r.range_ = range_<EOL>return r<EOL><DEDENT><DEDENT><DEDENT>elif other.conflict:<EOL><INDENT>range_ = self.range_ - other.range_<EOL>if range_ is None:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>r = _r(self)<EOL>r.range_ = range_<EOL>return r<EOL><DEDENT><DEDENT>else:<EOL><INDENT>range_ = self.range_ & other.range_<EOL>if range_ is None:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>r = _r(self)<EOL>r.range_ = range_<EOL>return r<EOL><DEDENT><DEDENT>
Returns the merged result of two requirements.

        Two requirements can be in conflict and if so, this function returns
        None. For example, requests for "foo-4" and "foo-6" are in conflict,
        since both cannot be satisfied with a single version of foo.

        Some example successful requirements merges are:
        - "foo-3+" and "!foo-5+" == "foo-3+<5"
        - "foo-1" and "foo-1.5" == "foo-1.5"
        - "!foo-2" and "!foo-5" == "!foo-2|5"